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

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

Issue 2923163007: Implemented telemetry benchmark that loads page and outputs screenshot. (Closed)
Patch Set: 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 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)
OLDNEW
« tools/perf/measurements/pixel_diff.py ('K') | « tools/perf/measurements/pixel_diff.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698