power_VideoPlayback: create means to run individual codec/res/fps.

To aide in creating tests for our battery life qualification add a
means to identify individual videos (or sets) based on key naming of
the <codec>_<resolution>_<frame rate>.

Also created an example control file doing that for vp9_1080_30fps.

BUG=b:149258668
TEST=power_VideoPlayback.vp9_1080_30fps power_VideoPlayback.fast

Change-Id: I9260265fb36be7a91c4ae5969988956a7a602934
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2543121
Reviewed-by: Puthikorn Voravootivat <puthik@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
diff --git a/client/site_tests/power_VideoPlayback/control.vp9_1080_30fps b/client/site_tests/power_VideoPlayback/control.vp9_1080_30fps
new file mode 100644
index 0000000..e5d9bd9
--- /dev/null
+++ b/client/site_tests/power_VideoPlayback/control.vp9_1080_30fps
@@ -0,0 +1,18 @@
+AUTHOR = "Chrome OS Team"
+NAME = "power_VideoPlayback.vp9_1080_30fps"
+PURPOSE = "Measure video playback power usage."
+CRITERIA = "This test is a benchmark."
+TIME = "SHORT"
+TEST_CATEGORY = "Benchmark"
+TEST_CLASS = "power"
+TEST_TYPE = "client"
+ATTRIBUTES = ""
+DOC = """
+Test video decode for vp9 1080p 30fps for 6min
+"""
+
+args_dict = utils.args_to_dict(args)
+pdash_note = args_dict.get('pdash_note', '')
+job.run_test('power_VideoPlayback', tag=NAME.split('.')[1],
+             videos=[('vp9_1080_30fps', '')], secs_per_video=360,
+             pdash_note=pdash_note, seconds_period=10)
diff --git a/client/site_tests/power_VideoPlayback/power_VideoPlayback.py b/client/site_tests/power_VideoPlayback/power_VideoPlayback.py
index 20435aa..f5e444e 100644
--- a/client/site_tests/power_VideoPlayback/power_VideoPlayback.py
+++ b/client/site_tests/power_VideoPlayback/power_VideoPlayback.py
@@ -4,6 +4,7 @@
 import logging
 import os
 
+from autotest_lib.client.common_lib import error
 from autotest_lib.client.common_lib import file_utils
 from autotest_lib.client.cros.power import power_videotest
 
@@ -148,8 +149,21 @@
         @param use_hw_decode: if False, disable hw video decoding.
         @param fast: Use smaller set of videos when videos is None.
         """
+        default_videos = self._FAST_VIDEOS if fast else self._VIDEOS
         if not videos:
-            videos = self._FAST_VIDEOS if fast else self._VIDEOS
+            videos = default_videos
+        else:
+            for i, (tagname, url) in enumerate(videos):
+                if url:
+                    continue
+                # if url is unset & tagname matches default use that path.
+                for default in default_videos:
+                    if tagname == default[0]:
+                        videos[i] = default
+                        break
+                else:
+                    estr = 'Unable to find URL for video name %s' % tagname
+                    raise error.TestError(estr)
 
         super(power_VideoPlayback, self).run_once(
             videos, secs_per_video, use_hw_decode)