| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 from datetime import datetime | 4 from datetime import datetime |
| 5 import glob | 5 import glob |
| 6 import optparse | 6 import optparse |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 | 9 |
| 10 import cloud_storage_test_base | 10 import cloud_storage_test_base |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class PixelTestFailure(Exception): | 46 class PixelTestFailure(Exception): |
| 47 pass | 47 pass |
| 48 | 48 |
| 49 def _DidTestSucceed(tab): | 49 def _DidTestSucceed(tab): |
| 50 return tab.EvaluateJavaScript('domAutomationController._succeeded') | 50 return tab.EvaluateJavaScript('domAutomationController._succeeded') |
| 51 | 51 |
| 52 class _PixelValidator(cloud_storage_test_base.ValidatorBase): | 52 class _PixelValidator(cloud_storage_test_base.ValidatorBase): |
| 53 def CustomizeBrowserOptions(self, options): | 53 def CustomizeBrowserOptions(self, options): |
| 54 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') | 54 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') |
| 55 | 55 |
| 56 def ValidatePage(self, page, tab, results): | 56 def ValidateAndMeasurePage(self, page, tab, results): |
| 57 if not _DidTestSucceed(tab): | 57 if not _DidTestSucceed(tab): |
| 58 raise page_test.Failure('Page indicated a failure') | 58 raise page_test.Failure('Page indicated a failure') |
| 59 | 59 |
| 60 if not tab.screenshot_supported: | 60 if not tab.screenshot_supported: |
| 61 raise page_test.Failure('Browser does not support screenshot capture') | 61 raise page_test.Failure('Browser does not support screenshot capture') |
| 62 | 62 |
| 63 screenshot = tab.Screenshot(5) | 63 screenshot = tab.Screenshot(5) |
| 64 | 64 |
| 65 if not screenshot: | 65 if not screenshot: |
| 66 raise page_test.Failure('Could not capture screenshot') | 66 raise page_test.Failure('Could not capture screenshot') |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 default=default_reference_image_dir) | 159 default=default_reference_image_dir) |
| 160 | 160 |
| 161 def CreatePageSet(self, options): | 161 def CreatePageSet(self, options): |
| 162 page_set = super(Pixel, self).CreatePageSet(options) | 162 page_set = super(Pixel, self).CreatePageSet(options) |
| 163 for page in page_set.pages: | 163 for page in page_set.pages: |
| 164 page.script_to_evaluate_on_commit = test_harness_script | 164 page.script_to_evaluate_on_commit = test_harness_script |
| 165 return page_set | 165 return page_set |
| 166 | 166 |
| 167 def CreateExpectations(self, page_set): | 167 def CreateExpectations(self, page_set): |
| 168 return pixel_expectations.PixelExpectations() | 168 return pixel_expectations.PixelExpectations() |
| OLD | NEW |