Backout 992f2748681f (bug 811185) for breaking emulator tests
authorEd Morley <emorley@mozilla.com>
Wed, 14 Nov 2012 10:05:14 +0000
changeset 113213 83d175cb799d6340b185939ca388848a1a3d1e8d
parent 113212 e73ee9780c4df2d8d1cdec06e758f72709d35bd5
child 113214 87928cd21b40906730b5472b14d80faaaf4735be
child 113220 7ebfa541fb866714553578fb02cb3b28d506d986
push id23859
push useremorley@mozilla.com
push dateWed, 14 Nov 2012 14:36:31 +0000
treeherdermozilla-central@87928cd21b40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs811185
milestone19.0a1
backs out992f2748681f9e8bf202fcb47848965d379bc488
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout 992f2748681f (bug 811185) for breaking emulator tests
testing/marionette/client/marionette/emulator.py
testing/marionette/client/marionette/emulator_screen.py
testing/marionette/client/marionette/tests/unit/test_emulator.py
testing/marionette/client/marionette/tests/unit/test_emulator_screen.py
--- a/testing/marionette/client/marionette/emulator.py
+++ b/testing/marionette/client/marionette/emulator.py
@@ -14,17 +14,16 @@ import shutil
 import socket
 import subprocess
 from telnetlib import Telnet
 import tempfile
 import time
 
 from emulator_battery import EmulatorBattery
 from emulator_geo import EmulatorGeo
-from emulator_screen import EmulatorScreen
 
 
 class LogcatProc(ProcessHandlerMixin):
     """Process handler for logcat which saves all output to a logfile.
     """
 
     def __init__(self, logfile, cmd, **kwargs):
         self.logfile = logfile
@@ -55,17 +54,16 @@ class Emulator(object):
         self._adb_started = False
         self.logcat_dir = logcat_dir
         self.logcat_proc = None
         self.arch = arch
         self.binary = emulatorBinary
         self.res = res
         self.battery = EmulatorBattery(self)
         self.geo = EmulatorGeo(self)
-        self.screen = EmulatorScreen(self)
         self.homedir = homedir
         self.sdcard = sdcard
         self.noWindow = noWindow
         if self.homedir is not None:
             self.homedir = os.path.expanduser(homedir)
         self.dataImg = userdata
         self.copy_userdata = self.dataImg is None
 
@@ -356,17 +354,16 @@ waitFor(
         self._emulator_launched = True
 
         self.dm = devicemanagerADB.DeviceManagerADB(adbPath=self.adb,
                                                     deviceSerial='emulator-%d' % self.port)
 
         # bug 802877
         time.sleep(10)
         self.geo.set_default_location()
-        self.screen.initialize()
 
         if self.logcat_dir:
             self.save_logcat()
 
         # setup DNS fix for networking
         self._run_adb(['shell', 'setprop', 'net.dns1', '10.0.2.3'])
 
     def _save_logcat_proc(self, filename, cmd):
deleted file mode 100644
--- a/testing/marionette/client/marionette/emulator_screen.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-class EmulatorScreen(object):
-    """Class for screen related emulator commands."""
-
-    SO_PORTRAIT_PRIMARY = 'portrait-primary'
-    SO_PORTRAIT_SECONDARY = 'portrait-secondary'
-    SO_LANDSCAPE_PRIMARY = 'landscape-primary'
-    SO_LANDSCAPE_SECONDARY = 'landscape-secondary'
-
-    def __init__(self, emulator):
-        self.emulator = emulator
-
-    def initialize(self):
-        self.orientation = self.SO_PORTRAIT_PRIMARY
-
-    def _get_raw_orientation(self):
-        """Get the raw value of the current device orientation."""
-        response = self.emulator._run_telnet('sensor get orientation')
-
-        return response[0].split('=')[1].strip()
-
-    def _set_raw_orientation(self, data):
-        """Set the raw value of the specified device orientation."""
-        self.emulator._run_telnet('sensor set orientation %s' % data)
-
-    def get_orientation(self):
-        """Get the current device orientation.
-
-        Returns;
-            orientation -- Orientation of the device. One of:
-                            SO_PORTRAIT_PRIMARY - system buttons at the bottom
-                            SO_PORTRIAT_SECONDARY - system buttons at the top
-                            SO_LANDSCAPE_PRIMARY - system buttons at the right
-                            SO_LANDSCAPE_SECONDARY - system buttons at the left
-
-        """
-        data = self._get_raw_orientation()
-
-        if data == '0:-90:0':
-            orientation = self.SO_PORTRAIT_PRIMARY
-        elif data == '0:90:0':
-            orientation = self.SO_PORTRAIT_SECONDARY
-        elif data == '0:0:90':
-            orientation = self.SO_LANDSCAPE_PRIMARY
-        elif data == '0:0:-90':
-            orientation = self.SO_LANDSCAPE_SECONDARY
-        else:
-            raise ValueError('Unknown orientation sensor value: %s.' % data)
-
-        return orientation
-
-    def set_orientation(self, orientation):
-        """Set the specified device orientation.
-
-        Args
-            orientation -- Orientation of the device. One of:
-                            SO_PORTRAIT_PRIMARY - system buttons at the bottom
-                            SO_PORTRIAT_SECONDARY - system buttons at the top
-                            SO_LANDSCAPE_PRIMARY - system buttons at the right
-                            SO_LANDSCAPE_SECONDARY - system buttons at the left
-        """
-        if orientation == SO_PORTRAIT_PRIMARY:
-            data = '0:-90:0'
-        elif orientation == SO_PORTRAIT_SECONDARY:
-            data = '0:90:0'
-        elif orientation == SO_LANDSCAPE_PRIMARY:
-            data = '0:0:90'
-        elif orientation == SO_LANDSCAPE_SECONDARY:
-            data = '0:0:-90'
-        else:
-            raise ValueError('Invalid orientation: %s' % orientation)
-
-        self._set_raw_orientation(data)
-
-    orientation = property(get_orientation, set_orientation)
--- a/testing/marionette/client/marionette/tests/unit/test_emulator.py
+++ b/testing/marionette/client/marionette/tests/unit/test_emulator.py
@@ -1,12 +1,8 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
 from marionette_test import MarionetteTestCase
 from errors import JavascriptException, MarionetteException
 
 class TestEmulatorContent(MarionetteTestCase):
 
     def test_emulator_cmd(self):
         self.marionette.set_script_timeout(10000)
         expected = ["<build>",
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/test_emulator_screen.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from marionette_test import MarionetteTestCase
-
-
-class TestEmulatorScreen(MarionetteTestCase):
-
-    def setUp(self):
-        MarionetteTestCase.setUp(self)
-
-        self.screen = self.marionette.emulator.screen
-        self.screen.initialize()
-
-    def test_emulator_orientation(self):
-        self.assertEqual(self.screen.orientation, self.screen.SO_PORTRAIT_PRIMARY,
-                         'Orientation has been correctly initialized.')
-
-        self.sensor.orientation = self.sensor.SO_PORTRAIT_SECONDARY
-        self.assertEqual(self.sensor.orientation, self.sensor.SO_PORTRAIT_SECONDARY,
-                         'Orientation has been set to portrait-secondary')
-
-        self.sensor.orientation = self.sensor.SO_LANDSCAPE_PRIMARY
-        self.assertEqual(self.sensor.orientation, self.sensor.SO_LANDSCAPE_PRIMARY,
-                         'Orientation has been set to landscape-primary')
-
-        self.sensor.orientation = self.sensor.SO_LANDSCAPE_SECONDARY
-        self.assertEqual(self.sensor.orientation, self.sensor.SO_LANDSCAPE_SECONDARY,
-                         'Orientation has been set to landscape-secondary')
-
-        self.sensor.orientation = self.sensor.SO_PORTRAIT_PRIMARY
-        self.assertEqual(self.sensor.orientation, self.sensor.SO_PORTRAIT_PRIMARY,
-                         'Orientation has been set to portrait-primary')