video_VideoSeek: disable vp8 switchres for nyan

Add two parameters (codec, is_switchres) to run_test.
Add blacklist filter to skip the test if it matches
(board, codec, is_switchres)

Which board supports wildcards.

BUG=chromium:723982
TEST=manual test

Change-Id: I74d3d72b96eed777ce2347c0fd662ebe07374897
Reviewed-on: https://chromium-review.googlesource.com/509668
Commit-Ready: Pin-chih Lin <johnylin@chromium.org>
Tested-by: Pin-chih Lin <johnylin@chromium.org>
Reviewed-by: Kuang-che Wu <kcwu@chromium.org>
diff --git a/client/site_tests/video_VideoSeek/control.h264 b/client/site_tests/video_VideoSeek/control.h264
index 9ef784e..8625dee 100644
--- a/client/site_tests/video_VideoSeek/control.h264
+++ b/client/site_tests/video_VideoSeek/control.h264
@@ -24,4 +24,4 @@
 """
 
 video = 'http://commondatastorage.googleapis.com/chromiumos-test-assets-public/video_VideoSeek/video.mp4'
-job.run_test('video_VideoSeek', video=video)
+job.run_test('video_VideoSeek', codec='h264', is_switchres=False, video=video)
diff --git a/client/site_tests/video_VideoSeek/control.h264.switchres b/client/site_tests/video_VideoSeek/control.h264.switchres
index b54117f..54c9f27 100644
--- a/client/site_tests/video_VideoSeek/control.h264.switchres
+++ b/client/site_tests/video_VideoSeek/control.h264.switchres
@@ -25,4 +25,4 @@
 
 video = ('http://commondatastorage.googleapis.com/'
             'chromiumos-test-assets-public/MSE/switch_1080p_720p.mp4')
-job.run_test('video_VideoSeek', video=video)
+job.run_test('video_VideoSeek', codec='h264', is_switchres=True, video=video)
diff --git a/client/site_tests/video_VideoSeek/control.vp8 b/client/site_tests/video_VideoSeek/control.vp8
index c9cc820..17873f2 100644
--- a/client/site_tests/video_VideoSeek/control.vp8
+++ b/client/site_tests/video_VideoSeek/control.vp8
@@ -24,4 +24,4 @@
 """
 
 video = 'http://commondatastorage.googleapis.com/chromiumos-test-assets-public/video_VideoSeek/video.webm'
-job.run_test('video_VideoSeek', video=video)
+job.run_test('video_VideoSeek', codec='vp8', is_switchres=False, video=video)
diff --git a/client/site_tests/video_VideoSeek/control.vp8.switchres b/client/site_tests/video_VideoSeek/control.vp8.switchres
index ab418c8..edf5650 100644
--- a/client/site_tests/video_VideoSeek/control.vp8.switchres
+++ b/client/site_tests/video_VideoSeek/control.vp8.switchres
@@ -25,4 +25,4 @@
 
 video = ('http://commondatastorage.googleapis.com/chromiumos-test'
             '-assets-public/MSE/frame_size_change.webm')
-job.run_test('video_VideoSeek', video=video)
+job.run_test('video_VideoSeek', codec='vp8', is_switchres=True, video=video)
diff --git a/client/site_tests/video_VideoSeek/control.vp9 b/client/site_tests/video_VideoSeek/control.vp9
index c97e9e2..2324fb1 100644
--- a/client/site_tests/video_VideoSeek/control.vp9
+++ b/client/site_tests/video_VideoSeek/control.vp9
@@ -24,4 +24,4 @@
 """
 
 video = 'http://commondatastorage.googleapis.com/chromiumos-test-assets-public/Shaka-Dash/720.webm'
-job.run_test('video_VideoSeek', video=video)
+job.run_test('video_VideoSeek', codec='vp9', is_switchres=False, video=video)
diff --git a/client/site_tests/video_VideoSeek/video_VideoSeek.py b/client/site_tests/video_VideoSeek/video_VideoSeek.py
index 8769e5e..62a153c 100755
--- a/client/site_tests/video_VideoSeek/video_VideoSeek.py
+++ b/client/site_tests/video_VideoSeek/video_VideoSeek.py
@@ -2,6 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import fnmatch
 import logging
 import os
 
@@ -15,11 +16,42 @@
     """This test verifies video seek works in Chrome."""
     version = 1
 
-    def run_once(self, video):
+    def is_skipping_test(self, codec, is_switchres):
+        """Determine whether this test should skip.
+
+        @param codec: the codec to be tested, ex. 'vp8', 'vp9', 'h264'.
+        @param is_switchres: bool, True if using switch resolution video.
+        """
+        blacklist = [
+                # (board, codec, is_switchres); None if don't care.
+
+                # "board" supports Unix shell-type wildcards
+
+                # Disable vp8 switchres for nyan devices temporarily due to:
+                # crbug/699260
+                ('nyan', 'vp8', True), ('nyan-*', 'vp8', True)
+        ]
+
+        board = utils.get_current_board()
+
+        for entry in blacklist:
+            if ((entry[0] is None or fnmatch.fnmatch(board, entry[0])) and
+                (entry[1] is None or codec == entry[1]) and
+                (entry[2] is None or is_switchres == entry[2])):
+                return True
+
+        return False
+
+    def run_once(self, codec, is_switchres, video):
         """Tests whether video seek works by random seeks forward and backward.
 
+        @param codec: the codec to be tested, ex. 'vp8', 'vp9', 'h264'.
+        @param is_switchres: bool, True if using switch resolution video.
         @param video: Sample video file to be seeked in Chrome.
         """
+        if self.is_skipping_test(codec, is_switchres):
+            raise error.TestNAError('Skipping test run on this board.')
+
         with chrome.Chrome(init_network_controller=True) as cr:
             cr.browser.platform.SetHTTPServerDirectories(self.bindir)
             tab = cr.browser.tabs[0]