General power tests improvements and fixes.
- Adds an optional timeout argument for pushing files.
Defaults said timeout to 180 second.
- Removes redundant setup_class calls.
- Makes base_device_configuration include all of airplane_mode settings.
- Removes redudnant calls to airplane_mode since is now part of
base_device_configuration.
Bug: 146498379
Test: Local run
Change-Id: Ic37bc6155de26db805759ebd6e43c09245695580
diff --git a/acts/framework/acts/test_utils/instrumentation/power/instrumentation_power_test.py b/acts/framework/acts/test_utils/instrumentation/power/instrumentation_power_test.py
index dc6558b..e7b4a63 100644
--- a/acts/framework/acts/test_utils/instrumentation/power/instrumentation_power_test.py
+++ b/acts/framework/acts/test_utils/instrumentation/power/instrumentation_power_test.py
@@ -53,6 +53,7 @@
ACCEPTANCE_THRESHOLD = 'acceptance_threshold'
AUTOTESTER_LOG = 'autotester.log'
+DEFAULT_PUSH_FILE_TIMEOUT = 180
DISCONNECT_USB_FILE = 'disconnectusb.log'
POLLING_INTERVAL = 0.5
@@ -188,6 +189,11 @@
self.adb_run(DeviceGServices(
'gms_icing_extension_download_enabled').toggle(False))
+ # Comms
+ self.adb_run(common.wifi.toggle(False))
+ self.adb_run(common.bluetooth.toggle(False))
+ self.adb_run(common.airplane_mode.toggle(True))
+
# Misc. Google features
self.adb_run(goog.disable_playstore)
self.adb_run(goog.disable_volta)
@@ -275,12 +281,14 @@
raise ValueError('Couldn\'t determine if %s exists. '
'Expected yes/no, got %s' % (file_path, result[cmd]))
- def push_to_external_storage(self, file_path, dest=None):
+ def push_to_external_storage(self, file_path, dest=None,
+ timeout=DEFAULT_PUSH_FILE_TIMEOUT):
"""Pushes a file to {$EXTERNAL_STORAGE} and returns its final location.
Args:
file_path: The file to be pushed.
dest: Where within {$EXTERNAL_STORAGE} it should be pushed.
+ timeout: Float number of seconds to wait for the file to be pushed.
Returns: The absolute path where the file was pushed.
"""
@@ -291,7 +299,7 @@
self.log.info('clearing %s before pushing %s' % (dest_path, file_path))
self.ad_dut.adb.shell('rm -rf %s', dest_path)
self.log.info('pushing file %s to %s' % (file_path, dest_path))
- self.ad_dut.adb.push(file_path, dest_path)
+ self.ad_dut.adb.push(file_path, dest_path, timeout=timeout)
return dest_path
# Test runtime utils
diff --git a/acts/tests/google/instrumentation/power/idle/DisplayAlwaysOnTest.py b/acts/tests/google/instrumentation/power/idle/DisplayAlwaysOnTest.py
index fdae8f0..b891b0c 100644
--- a/acts/tests/google/instrumentation/power/idle/DisplayAlwaysOnTest.py
+++ b/acts/tests/google/instrumentation/power/idle/DisplayAlwaysOnTest.py
@@ -21,12 +21,8 @@
class DisplayAlwaysOnTest(instrumentation_power_test.InstrumentationPowerTest):
"""Test class for running instrumentation test DisplayAlwaysOn."""
- def setup_class(self):
- super().setup_class()
-
def _prepare_device(self):
super()._prepare_device()
- self.mode_airplane()
self.base_device_configuration()
self.adb_run(common.doze_mode.toggle(True))
self.adb_run(common.doze_always_on.toggle(True))
diff --git a/acts/tests/google/instrumentation/power/idle/PartialWakeLockTest.py b/acts/tests/google/instrumentation/power/idle/PartialWakeLockTest.py
index 6c1bd64..973c0f9 100644
--- a/acts/tests/google/instrumentation/power/idle/PartialWakeLockTest.py
+++ b/acts/tests/google/instrumentation/power/idle/PartialWakeLockTest.py
@@ -20,12 +20,8 @@
class PartialWakeLockTest(instrumentation_power_test.InstrumentationPowerTest):
"""Test class for running instrumentation test PartialWakeLock."""
- def setup_class(self):
- super().setup_class()
-
def _prepare_device(self):
super()._prepare_device()
- self.mode_airplane()
self.base_device_configuration()
def test_partial_wake_lock(self):
diff --git a/acts/tests/google/instrumentation/power/idle/RockBottomTest.py b/acts/tests/google/instrumentation/power/idle/RockBottomTest.py
index 1440110..43dd9f1 100644
--- a/acts/tests/google/instrumentation/power/idle/RockBottomTest.py
+++ b/acts/tests/google/instrumentation/power/idle/RockBottomTest.py
@@ -20,12 +20,8 @@
class RockBottomTest(instrumentation_power_test.InstrumentationPowerTest):
"""Test class for running instrumentation test RockBottom."""
- def setup_class(self):
- super().setup_class()
-
def _prepare_device(self):
super()._prepare_device()
- self.mode_airplane()
self.base_device_configuration()
def test_rock_bottom(self):
diff --git a/acts/tests/google/instrumentation/power/media/VideoPlaybackTest.py b/acts/tests/google/instrumentation/power/media/VideoPlaybackTest.py
index 02ddaa8..f4364f2 100644
--- a/acts/tests/google/instrumentation/power/media/VideoPlaybackTest.py
+++ b/acts/tests/google/instrumentation/power/media/VideoPlaybackTest.py
@@ -16,24 +16,23 @@
from acts.test_utils.instrumentation.power import instrumentation_power_test
+BIG_FILE_PUSH_TIMEOUT = 600
+
class VideoPlaybackTest(
instrumentation_power_test.InstrumentationPowerTest):
"""Test class for running instrumentation tests
VideoPlaybackHighBitRateTest."""
- def setup_class(self):
- super().setup_class()
-
def _prepare_device(self):
super()._prepare_device()
- self.mode_airplane()
self.base_device_configuration()
def test_playback_high_bit_rate(self):
"""Measures power when the device is in a rock bottom state."""
video_location = self.push_to_external_storage(
- self._instrumentation_config.get_file('high_bit_rate_video'))
+ self._instrumentation_config.get_file('high_bit_rate_video'),
+ timeout=BIG_FILE_PUSH_TIMEOUT)
self.trigger_scan_on_external_storage()
self.run_and_measure(