OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 import glob | 4 import glob |
5 import logging | 5 import logging |
6 import os | 6 import os |
7 import re | 7 import re |
8 import sys | 8 import sys |
9 | 9 |
10 from gpu_tests import gpu_integration_test | 10 from gpu_tests import gpu_integration_test |
11 from gpu_tests import cloud_storage_integration_test_base | 11 from gpu_tests import cloud_storage_integration_test_base |
12 from gpu_tests import pixel_expectations | 12 from gpu_tests import pixel_expectations |
13 from gpu_tests import pixel_test_pages | 13 from gpu_tests import pixel_test_pages |
14 | 14 |
15 from py_utils import cloud_storage | 15 from py_utils import cloud_storage |
16 from telemetry.util import image_util | 16 from telemetry.util import image_util |
17 | 17 |
| 18 root_data_path = os.path.abspath(os.path.join( |
| 19 os.path.dirname(__file__), '..', '..', 'data')) |
| 20 gpu_data_dir = os.path.join(root_data_path, 'gpu') |
18 | 21 |
19 test_data_dir = os.path.abspath(os.path.join( | 22 default_reference_image_dir = os.path.join(gpu_data_dir, 'gpu_reference') |
20 os.path.dirname(__file__), '..', '..', 'data', 'gpu')) | |
21 | 23 |
22 default_reference_image_dir = os.path.join(test_data_dir, 'gpu_reference') | 24 test_data_dirs = [gpu_data_dir, |
| 25 os.path.join(root_data_path, 'media')] |
23 | 26 |
24 test_harness_script = r""" | 27 test_harness_script = r""" |
25 var domAutomationController = {}; | 28 var domAutomationController = {}; |
26 | 29 |
27 domAutomationController._succeeded = false; | 30 domAutomationController._succeeded = false; |
28 domAutomationController._finished = false; | 31 domAutomationController._finished = false; |
29 | 32 |
30 domAutomationController.setAutomationId = function(id) {} | 33 domAutomationController.setAutomationId = function(id) {} |
31 | 34 |
32 domAutomationController.send = function(msg) { | 35 domAutomationController.send = function(msg) { |
(...skipping 28 matching lines...) Expand all Loading... |
61 def Name(cls): | 64 def Name(cls): |
62 """The name by which this test is invoked on the command line.""" | 65 """The name by which this test is invoked on the command line.""" |
63 return 'pixel' | 66 return 'pixel' |
64 | 67 |
65 @classmethod | 68 @classmethod |
66 def SetUpProcess(cls): | 69 def SetUpProcess(cls): |
67 super(cls, PixelIntegrationTest).SetUpProcess() | 70 super(cls, PixelIntegrationTest).SetUpProcess() |
68 cls._original_finder_options = cls._finder_options.Copy() | 71 cls._original_finder_options = cls._finder_options.Copy() |
69 cls.CustomizeBrowserArgs([]) | 72 cls.CustomizeBrowserArgs([]) |
70 cls.StartBrowser() | 73 cls.StartBrowser() |
71 cls.SetStaticServerDirs([test_data_dir]) | 74 cls.SetStaticServerDirs(test_data_dirs) |
72 | 75 |
73 @classmethod | 76 @classmethod |
74 def CustomizeBrowserArgs(cls, browser_args): | 77 def CustomizeBrowserArgs(cls, browser_args): |
75 if not browser_args: | 78 if not browser_args: |
76 browser_args = [] | 79 browser_args = [] |
77 cls._finder_options = cls._original_finder_options.Copy() | 80 cls._finder_options = cls._original_finder_options.Copy() |
78 browser_options = cls._finder_options.browser_options | 81 browser_options = cls._finder_options.browser_options |
79 # All tests receive these options. They aren't recorded in the | 82 # All tests receive these options. They aren't recorded in the |
80 # _last_launched_browser_args. | 83 # _last_launched_browser_args. |
81 browser_options.AppendExtraBrowserArgs(['--enable-gpu-benchmarking', | 84 browser_options.AppendExtraBrowserArgs(['--enable-gpu-benchmarking', |
(...skipping 30 matching lines...) Expand all Loading... |
112 @classmethod | 115 @classmethod |
113 def GenerateGpuTests(cls, options): | 116 def GenerateGpuTests(cls, options): |
114 cls.SetParsedCommandLineOptions(options) | 117 cls.SetParsedCommandLineOptions(options) |
115 name = 'Pixel' | 118 name = 'Pixel' |
116 pages = pixel_test_pages.DefaultPages(name) | 119 pages = pixel_test_pages.DefaultPages(name) |
117 pages += pixel_test_pages.GpuRasterizationPages(name) | 120 pages += pixel_test_pages.GpuRasterizationPages(name) |
118 pages += pixel_test_pages.ExperimentalCanvasFeaturesPages(name) | 121 pages += pixel_test_pages.ExperimentalCanvasFeaturesPages(name) |
119 if sys.platform.startswith('darwin'): | 122 if sys.platform.startswith('darwin'): |
120 pages += pixel_test_pages.MacSpecificPages(name) | 123 pages += pixel_test_pages.MacSpecificPages(name) |
121 for p in pages: | 124 for p in pages: |
122 yield(p.name, p.url, (p)) | 125 yield(p.name, "gpu/" + p.url, (p)) |
123 | 126 |
124 def RunActualGpuTest(self, test_path, *args): | 127 def RunActualGpuTest(self, test_path, *args): |
125 page = args[0] | 128 page = args[0] |
126 # Some pixel tests require non-standard browser arguments. Need to | 129 # Some pixel tests require non-standard browser arguments. Need to |
127 # check before running each page that it can run in the current | 130 # check before running each page that it can run in the current |
128 # browser instance. | 131 # browser instance. |
129 self.RestartBrowserIfNecessaryWithArgs(page.browser_args) | 132 self.RestartBrowserIfNecessaryWithArgs(page.browser_args) |
130 url = self.UrlOfStaticFilePath(test_path) | 133 url = self.UrlOfStaticFilePath(test_path) |
131 # This property actually comes off the class, not 'self'. | 134 # This property actually comes off the class, not 'self'. |
132 tab = self.tab | 135 tab = self.tab |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 227 |
225 print ('Reference image not found. Writing tab contents as reference to: ' + | 228 print ('Reference image not found. Writing tab contents as reference to: ' + |
226 image_path) | 229 image_path) |
227 | 230 |
228 self._WriteImage(image_path, screenshot) | 231 self._WriteImage(image_path, screenshot) |
229 return screenshot | 232 return screenshot |
230 | 233 |
231 def load_tests(loader, tests, pattern): | 234 def load_tests(loader, tests, pattern): |
232 del loader, tests, pattern # Unused. | 235 del loader, tests, pattern # Unused. |
233 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__]) | 236 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__]) |
OLD | NEW |