Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 import shutil | |
|
wkorman
2017/06/07 20:15:12
+1 blank above
| |
| 5 import tempfile | |
| 6 | |
| 7 from telemetry.testing import options_for_unittests | |
| 8 from telemetry.testing import page_test_test_case | |
| 9 | |
| 10 from measurements import pixel_diff | |
| 11 | |
| 12 class PixelDiffUnitTest(page_test_test_case.PageTestTestCase): | |
| 13 | |
| 14 def setUp(self): | |
| 15 self._options = options_for_unittests.GetCopy() | |
| 16 self._png_outdir = tempfile.mkdtemp('_png_test') | |
| 17 | |
| 18 def tearDown(self): | |
| 19 shutil.rmtree(self._png_outdir) | |
| 20 | |
| 21 def testPixelDiff(self): | |
| 22 ps = self.CreateStorySetFromFileInUnittestDataDir('blank.html') | |
|
wkorman
2017/06/07 20:15:12
Rename ps -> page_set for better understandability
| |
| 23 measurement = pixel_diff.PixelDiff(self._png_outdir) | |
| 24 results = self.RunMeasurement(measurement, ps, options=self._options) | |
| 25 | |
| 26 # Screenshots are not supported on all platforms | |
|
wkorman
2017/06/07 20:15:12
We should make sure this test fails somehow if for
| |
| 27 if results.failures: | |
| 28 assert 'not supported' in results.failures[0].exc_info[1].message | |
| 29 return | |
| 30 | |
| 31 saved_picture_count = results.FindAllPageSpecificValuesNamed( | |
| 32 'saved_picture_count') | |
| 33 self.assertEquals(len(saved_picture_count), 1) | |
| 34 self.assertGreater(saved_picture_count[0].GetRepresentativeNumber(), 0) | |
| OLD | NEW |