Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: tools/perf/measurements/screenshot_unittest.py

Issue 2923163007: Implemented telemetry benchmark that loads page and outputs screenshot. (Closed)
Patch Set: Changed name to Screenshot, added logging, error handling, more descriptive comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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)
OLDNEW
« tools/perf/measurements/screenshot.py ('K') | « tools/perf/measurements/screenshot.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698