Run superhero benchmarks w/ Android enabled in crosbolt_arc_perf_perbuild suite

BUG=b/27599221
TEST=Ran locally

Change-Id: I79359d86b503f53b9521a6c9dd13437ac1ab9690
Reviewed-on: https://chromium-review.googlesource.com/346207
Commit-Ready: Rohit Makasana <rohitbm@chromium.org>
Tested-by: Rohit Makasana <rohitbm@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Keith Haddow <haddowk@chromium.org>
diff --git a/client/site_tests/video_PlaybackPerf/control.h264.arc b/client/site_tests/video_PlaybackPerf/control.h264.arc
new file mode 100644
index 0000000..3cec927
--- /dev/null
+++ b/client/site_tests/video_PlaybackPerf/control.h264.arc
@@ -0,0 +1,27 @@
+# Copyright 2016 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.
+
+AUTHOR = "Chrome OS Project, chromeos-video@google.com"
+NAME = "video_PlaybackPerf.h264.arc"
+PURPOSE = "Test the cpu usage and dropped frame count of H264 video playback"
+CRITERIA = """
+The test outputs the cpu usage and dropped frame count of H264 video playback.
+"""
+ATTRIBUTES = "suite:crosbolt_arc_perf_perbuild"
+TIME = "MEDIUM"
+TEST_CATEGORY = "Performance"
+TEST_CLASS = "video"
+TEST_TYPE = "client"
+ARC_MODE = "enabled"
+
+DOC = """
+This test measures the CPU usage and dropped frame count of H264 video playback
+for software decode on all devices and hardware decode on those devices with
+hardware acceleration support.
+"""
+
+VIDEO_NAME = 'traffic-1920x1080-8005020218f6b86bfa978e550d04956e.mp4'
+VIDEO_DESCRIPTION = 'h264_1080p'
+job.run_test('video_PlaybackPerf', video_name=VIDEO_NAME,
+             video_description=VIDEO_DESCRIPTION, arc_mode=ARC_MODE)
diff --git a/client/site_tests/video_PlaybackPerf/control.vp9.arc b/client/site_tests/video_PlaybackPerf/control.vp9.arc
new file mode 100644
index 0000000..2e46c4f
--- /dev/null
+++ b/client/site_tests/video_PlaybackPerf/control.vp9.arc
@@ -0,0 +1,27 @@
+# Copyright 2016 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.
+
+AUTHOR = "Chrome OS Project, chromeos-video@google.com"
+NAME = "video_PlaybackPerf.vp9.arc"
+PURPOSE = "Test the cpu usage and dropped frame count of VP9 video playback"
+CRITERIA = """
+The test outputs the cpu usage and dropped frame count of VP9 video playback.
+"""
+ATTRIBUTES = "suite:crosbolt_arc_perf_perbuild"
+TIME = "MEDIUM"
+TEST_CATEGORY = "Performance"
+TEST_CLASS = "video"
+TEST_TYPE = "client"
+ARC_MODE = "enabled"
+
+DOC = """
+This test measures the CPU usage and dropped frame count of VP9 video playback
+for software decode on all devices and hardware decode on those devices with
+hardware acceleration support.
+"""
+
+VIDEO_NAME = 'traffic-1920x1080-83a1e5f8b7944577425f039034e64c76.vp9.webm'
+VIDEO_DESCRIPTION = 'vp9_1080p'
+job.run_test('video_PlaybackPerf', video_name=VIDEO_NAME,
+             video_description=VIDEO_DESCRIPTION, arc_mode=ARC_MODE)
diff --git a/client/site_tests/video_PlaybackPerf/video_PlaybackPerf.py b/client/site_tests/video_PlaybackPerf/video_PlaybackPerf.py
index d0fdf86..86c7fdd 100644
--- a/client/site_tests/video_PlaybackPerf/video_PlaybackPerf.py
+++ b/client/site_tests/video_PlaybackPerf/video_PlaybackPerf.py
@@ -53,6 +53,7 @@
     consumption for video playback to performance dashboard.
     """
     version = 1
+    arc_mode = None
 
 
     def initialize(self):
@@ -77,7 +78,8 @@
                                "loop=true")
 
 
-    def run_once(self, video_name, video_description, power_test=False):
+    def run_once(self, video_name, video_description, power_test=False,
+                 arc_mode=None):
         """
         Runs the video_PlaybackPerf test.
 
@@ -87,12 +89,14 @@
         @param power_test: True if this is a power test and it would only run
                 the power test. If False, it would run the cpu usage test and
                 the dropped frame count test.
+        @param arc_mode: if 'enabled', run the test with Android enabled.
         """
         # Download test video.
         url = DOWNLOAD_BASE + video_name
         local_path = os.path.join(self.bindir, os.path.basename(video_name))
         logging.info("Downloading %s to %s", url, local_path);
         file_utils.download_file(url, local_path)
+        self.arc_mode = arc_mode
 
         if not power_test:
             # Run the video playback dropped frame tests.
@@ -229,7 +233,7 @@
         """
         keyvals = {}
 
-        with chrome.Chrome() as cr:
+        with chrome.Chrome(arc_mode=self.arc_mode) as cr:
             # Open the video playback page and start playing.
             self.start_playback(cr, local_path)
             result = gather_result(cr)
@@ -247,7 +251,8 @@
 
         # Start chrome with disabled video hardware decode flag.
         with chrome.Chrome(extra_browser_args=
-                DISABLE_ACCELERATED_VIDEO_DECODE_BROWSER_ARGS) as cr:
+                DISABLE_ACCELERATED_VIDEO_DECODE_BROWSER_ARGS,
+                arc_mode=self.arc_mode) as cr:
             # Open the video playback page and start playing.
             self.start_playback(cr, local_path)
             result = gather_result(cr)
diff --git a/client/site_tests/video_WebRtcPerf/control.arc b/client/site_tests/video_WebRtcPerf/control.arc
new file mode 100644
index 0000000..ef3ea74
--- /dev/null
+++ b/client/site_tests/video_WebRtcPerf/control.arc
@@ -0,0 +1,32 @@
+# Copyright 2016 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.
+
+AUTHOR = "Chrome OS Project, chromeos-video@google.com"
+NAME = "video_WebRtcPerf.arc"
+PURPOSE = "Measure the CPU usage and decode time of WebRTC"
+CRITERIA = "This is a performance test and does not fail."
+ATTRIBUTES = "suite:crosbolt_arc_perf_perbuild"
+TIME = "MEDIUM"
+TEST_CATEGORY = "Performance"
+TEST_CLASS = "video"
+TEST_TYPE = "client"
+BUG_TEMPLATE = {
+    "labels": ["OS-Chrome", "VideoTestFailure"],
+    'cc': ['chromeos-video-test-failures@google.com'],
+}
+ARC_MODE = "enabled"
+
+DOC = """
+This test outputs the CPU usage and decode time of WebRTC with and without
+hardware acceleration to the performance dashboard. The test runs on all the
+devices. The output can be used to compare the performance between using
+hardware and software. It can also be used to compare the performance among
+different devices.
+"""
+
+job.run_test("video_WebRtcPerf",
+             decode_time_test=True,
+             cpu_test=True,
+             power_test=False,
+             arc_mode=ARC_MODE)
diff --git a/client/site_tests/video_WebRtcPerf/video_WebRtcPerf.py b/client/site_tests/video_WebRtcPerf/video_WebRtcPerf.py
index f0a71e8..0e63359 100644
--- a/client/site_tests/video_WebRtcPerf/video_WebRtcPerf.py
+++ b/client/site_tests/video_WebRtcPerf/video_WebRtcPerf.py
@@ -92,6 +92,7 @@
     WebRTC to performance dashboard.
     """
     version = 1
+    arc_mode = None
 
 
     def start_loopback(self, cr):
@@ -124,18 +125,21 @@
         return tab
 
 
-    def run_once(self, decode_time_test=False, cpu_test=False, power_test=False):
+    def run_once(self, decode_time_test=False, cpu_test=False,
+                 power_test=False, arc_mode=None):
         """
         Runs the video_WebRtcPerf test.
 
         @param decode_time_test: Pass True to run decode time test.
         @param cpu_test: Pass True to run CPU usage test.
         @param power_test: Pass True to run power consumption test.
+        @param arc_mode: if 'enabled', run the test with Android enabled.
         """
         # Download test video.
         url = DOWNLOAD_BASE + VIDEO_NAME
         local_path = os.path.join(self.bindir, VIDEO_NAME)
         file_utils.download_file(url, local_path)
+        self.arc_mode = arc_mode
 
         if decode_time_test:
             keyvals = self.test_decode_time(local_path)
@@ -174,7 +178,8 @@
         keyvals = {}
         EXTRA_BROWSER_ARGS.append(FAKE_FILE_ARG % local_path)
 
-        with chrome.Chrome(extra_browser_args=EXTRA_BROWSER_ARGS) as cr:
+        with chrome.Chrome(extra_browser_args=EXTRA_BROWSER_ARGS,
+                           arc_mode=self.arc_mode) as cr:
             # On daisy, Chrome freezes about 30 seconds after login because of
             # TPM error. See http://crbug.com/588579.
             if utils.get_board() == 'daisy':
@@ -198,7 +203,7 @@
         # Start chrome with disabled video hardware decode flag.
         with chrome.Chrome(extra_browser_args=
                 DISABLE_ACCELERATED_VIDEO_DECODE_BROWSER_ARGS +
-                EXTRA_BROWSER_ARGS) as cr:
+                EXTRA_BROWSER_ARGS, arc_mode=self.arc_mode) as cr:
             if utils.get_board() == 'daisy':
               logging.warning('Delay 30s for issue 588579 on daisy')
               time.sleep(30)