| OLD | NEW |
| 1 # Copyright 2014 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 | 4 |
| 5 import shutil | 5 import shutil |
| 6 import tempfile | 6 import tempfile |
| 7 | 7 |
| 8 from telemetry import decorators | 8 from telemetry import decorators |
| 9 from telemetry.testing import options_for_unittests | 9 from telemetry.testing import options_for_unittests |
| 10 from telemetry.testing import page_test_test_case | 10 from telemetry.testing import page_test_test_case |
| 11 | 11 |
| 12 from measurements import skpicture_printer | 12 from measurements import multipage_skpicture_printer |
| 13 | 13 |
| 14 | 14 |
| 15 class SkpicturePrinterUnitTest(page_test_test_case.PageTestTestCase): | 15 class MultipageSkpicturePrinterUnitTest(page_test_test_case.PageTestTestCase): |
| 16 | 16 |
| 17 def setUp(self): | 17 def setUp(self): |
| 18 self._options = options_for_unittests.GetCopy() | 18 self._options = options_for_unittests.GetCopy() |
| 19 self._skp_outdir = tempfile.mkdtemp('_skp_test') | 19 self._mskp_outdir = tempfile.mkdtemp('_mskp_test') |
| 20 | 20 |
| 21 def tearDown(self): | 21 def tearDown(self): |
| 22 shutil.rmtree(self._skp_outdir) | 22 shutil.rmtree(self._mskp_outdir) |
| 23 | 23 |
| 24 @decorators.Disabled('android') | 24 @decorators.Disabled('android') |
| 25 def testSkpicturePrinter(self): | 25 def testSkpicturePrinter(self): |
| 26 ps = self.CreateStorySetFromFileInUnittestDataDir('blank.html') | 26 ps = self.CreateStorySetFromFileInUnittestDataDir('blank.html') |
| 27 measurement = skpicture_printer.SkpicturePrinter(self._skp_outdir) | 27 measurement = multipage_skpicture_printer.MultipageSkpicturePrinter( |
| 28 self._mskp_outdir) |
| 28 results = self.RunMeasurement(measurement, ps, options=self._options) | 29 results = self.RunMeasurement(measurement, ps, options=self._options) |
| 29 | 30 |
| 30 # Picture printing is not supported on all platforms. | 31 # Picture printing is not supported on all platforms. |
| 31 if results.failures: | 32 if results.failures: |
| 32 assert 'not supported' in results.failures[0].exc_info[1].message | 33 assert 'not supported' in results.failures[0].exc_info[1].message |
| 33 return | 34 return |
| 34 | |
| 35 saved_picture_count = results.FindAllPageSpecificValuesNamed( | |
| 36 'saved_picture_count') | |
| 37 self.assertEquals(len(saved_picture_count), 1) | |
| 38 self.assertGreater(saved_picture_count[0].GetRepresentativeNumber(), 0) | |
| OLD | NEW |