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 | |
| 5 import shutil | |
| 6 import tempfile | |
| 7 | |
| 8 from telemetry.testing import options_for_unittests | |
| 9 from telemetry.testing import page_test_test_case | |
| 10 | |
| 11 from measurements import screenshot | |
| 12 | |
| 13 class ScreenshotUnitTest(page_test_test_case.PageTestTestCase): | |
| 14 | |
| 15 def setUp(self): | |
| 16 self._options = options_for_unittests.GetCopy() | |
| 17 self._png_outdir = tempfile.mkdtemp('_png_test') | |
| 18 | |
| 19 def tearDown(self): | |
| 20 shutil.rmtree(self._png_outdir) | |
| 21 | |
| 22 def testPixelDiff(self): | |
| 23 page_set = self.CreateStorySetFromFileInUnittestDataDir('blank.html') | |
| 24 measurement = screenshot.Screenshot(self._png_outdir) | |
| 25 results = self.RunMeasurement(measurement, page_set, options=self._options) | |
| 26 | |
| 27 # Screenshots are not supported on all platforms | |
| 28 if results.failures: | |
|
wkorman
2017/06/08 17:57:53
Looks like we still need to figure out some way to
| |
| 29 assert 'not supported' in results.failures[0].exc_info[1].message | |
| 30 return | |
| 31 | |
| 32 saved_picture_count = results.FindAllPageSpecificValuesNamed( | |
| 33 'saved_picture_count') | |
| 34 self.assertEquals(len(saved_picture_count), 1) | |
| 35 self.assertGreater(saved_picture_count[0].GetRepresentativeNumber(), 0) | |
| OLD | NEW |