power_VideoCall: Add new power_VideoCall test
This simulates go/atlasvc workload.
- Camera preview in 720p using VP9 codec.
- Four 720p 30fps video playback with two VP8 videos and two VP9 videos.
- Google Doc with emulated typing.
BUG=b:146021591
TEST=Run the test
Change-Id: I660b362cb5232cedc6eeb2d01792946da3a6522a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1961144
Tested-by: Puthikorn Voravootivat <puthik@chromium.org>
Auto-Submit: Puthikorn Voravootivat <puthik@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Reviewed-by: Mengqi Guo <mqg@chromium.org>
diff --git a/client/site_tests/power_VideoCall/control b/client/site_tests/power_VideoCall/control
new file mode 100644
index 0000000..86793ce
--- /dev/null
+++ b/client/site_tests/power_VideoCall/control
@@ -0,0 +1,23 @@
+AUTHOR = "puthik"
+NAME = "power_VideoCall"
+PURPOSE = "Simulates video call multitasking."
+CRITERIA = "This test is a benchmark."
+TIME = "LONG"
+TEST_CATEGORY = "Benchmark"
+TEST_CLASS = "power"
+TEST_TYPE = "client"
+
+DOC = """
+This test simulates video call multitasking and record power related statistic.
+
+Workload
+- Camera preview in 720p using VP9 codec.
+- Four 720p 30fps video playback with two VP8 videos and two VP9 videos.
+- Google Doc with emulated typing.
+
+The run time is 2 hours to allow the DUT to heat up to steady state.
+"""
+
+args_dict = utils.args_to_dict(args)
+pdash_note = args_dict.get('pdash_note', '')
+job.run_test('power_VideoCall', pdash_note=pdash_note)
diff --git a/client/site_tests/power_VideoCall/control.25min b/client/site_tests/power_VideoCall/control.25min
new file mode 100644
index 0000000..bb4f8d5
--- /dev/null
+++ b/client/site_tests/power_VideoCall/control.25min
@@ -0,0 +1,24 @@
+AUTHOR = "puthik"
+NAME = "power_VideoCall.25min"
+PURPOSE = "Simulates video call multitasking."
+CRITERIA = "This test is a benchmark."
+TIME = "LONG"
+TEST_CATEGORY = "Benchmark"
+TEST_CLASS = "power"
+TEST_TYPE = "client"
+
+DOC = """
+This test simulates video call multitasking and record power related statistic.
+
+Workload
+- Camera preview in 720p using VP9 codec.
+- Four 720p 30fps video playback with two VP8 videos and two VP9 videos.
+- Google Doc with emulated typing.
+
+The version runs for 25 minutes as it is common duration of the video call.
+"""
+
+args_dict = utils.args_to_dict(args)
+pdash_note = args_dict.get('pdash_note', '')
+job.run_test('power_VideoCall', pdash_note=pdash_note, duration=1500,
+ tag=NAME.split('.')[1])
diff --git a/client/site_tests/power_VideoCall/control.fast b/client/site_tests/power_VideoCall/control.fast
new file mode 100644
index 0000000..77a398f
--- /dev/null
+++ b/client/site_tests/power_VideoCall/control.fast
@@ -0,0 +1,24 @@
+AUTHOR = "puthik"
+NAME = "power_VideoCall.fast"
+PURPOSE = "Make sure power_VideoCall works fine."
+CRITERIA = "This test is a benchmark."
+TIME = "SHORT"
+TEST_CATEGORY = "Benchmark"
+TEST_CLASS = "power"
+TEST_TYPE = "client"
+
+DOC = """
+This test simulates video call multitasking and record power related statistic.
+
+Workload
+- Camera preview in 720p using VP9 codec.
+- Four 720p 30fps video playback with two VP8 videos and two VP9 videos.
+- Google Doc with emulated typing.
+
+The fast version only runs for 3 minutes to make sure the test works as expected.
+"""
+
+args_dict = utils.args_to_dict(args)
+pdash_note = args_dict.get('pdash_note', '')
+job.run_test('power_VideoCall', pdash_note=pdash_note, duration=180,
+ tag=NAME.split('.')[1], seconds_period=5)
diff --git a/client/site_tests/power_VideoCall/power_VideoCall.py b/client/site_tests/power_VideoCall/power_VideoCall.py
new file mode 100644
index 0000000..54cfe53
--- /dev/null
+++ b/client/site_tests/power_VideoCall/power_VideoCall.py
@@ -0,0 +1,64 @@
+# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import logging
+import time
+
+from autotest_lib.client.common_lib.cros import chrome
+from autotest_lib.client.common_lib.cros import power_load_util
+from autotest_lib.client.cros.input_playback import keyboard
+from autotest_lib.client.cros.power import power_test
+
+
+class power_VideoCall(power_test.power_Test):
+ """class for power_VideoCall test."""
+ version = 1
+
+ video_url = 'http://crospower.page.link/power_VideoCall'
+ doc_url = 'http://doc.new'
+ extra_browser_args = ['--use-fake-ui-for-media-stream']
+
+ def initialize(self, seconds_period=20., pdash_note=''):
+ """initialize method."""
+ super(power_VideoCall, self).initialize(seconds_period=seconds_period,
+ pdash_note=pdash_note)
+ self._username = power_load_util.get_username()
+ self._password = power_load_util.get_password()
+
+ def run_once(self, duration=7200):
+ """run_once method.
+
+ @param duration: time in seconds to display url and measure power.
+ """
+ with keyboard.Keyboard() as keys,\
+ chrome.Chrome(init_network_controller=True,
+ gaia_login=True,
+ username=self._username,
+ password=self._password,
+ extra_browser_args=self.extra_browser_args,
+ autotest_ext=True) as cr:
+
+ # Move existing window to left half and open video page
+ tab_left = cr.browser.tabs[0]
+ tab_left.Activate()
+ keys.press_key('alt+[')
+ logging.info('Navigating left window to %s', self.video_url)
+ tab_left.Navigate(self.video_url)
+ tab_left.WaitForDocumentReadyStateToBeComplete()
+ time.sleep(5)
+
+ # Open Google Doc on right half
+ logging.info('Navigating right window to %s', self.doc_url)
+ cmd = 'chrome.windows.create({ url : "%s" });' % self.doc_url
+ cr.autotest_ext.EvaluateJavaScript(cmd)
+ tab_right = cr.browser.tabs[-1]
+ tab_right.Activate()
+ keys.press_key('alt+]')
+ tab_right.WaitForDocumentReadyStateToBeComplete()
+ time.sleep(5)
+
+ # Start typing number block
+ end_time = time.time() + duration
+ self.start_measurements()
+ while time.time() < end_time:
+ keys.press_key('number_block')