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

Side by Side Diff: tools/perf/contrib/cluster_telemetry/screenshot_unittest.py

Issue 2923163007: Implemented telemetry benchmark that loads page and outputs screenshot. (Closed)
Patch Set: Moved files to tools/perf/contrib/cluster_telemetry, more logging, detecting if run on Linux in uniā€¦ 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 platform
6 import shutil
7 import tempfile
8
9 from telemetry.testing import options_for_unittests
10 from telemetry.testing import page_test_test_case
11 from contrib.cluster_telemetry 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 not supported if failure occurs on Linux
28 if results.failures and platform.system() == 'Linux':
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

Powered by Google App Engine
This is Rietveld 408576698