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

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

Issue 637153002: telemetry: Remove command line args from page test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Suppress pylint E1003 Created 6 years, 1 month 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
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 logging 5 import logging
6 import shutil 6 import shutil
7 import tempfile 7 import tempfile
8 8
9 from measurements import screenshot 9 from measurements import screenshot
10 from telemetry import benchmark 10 from telemetry import benchmark
11 from telemetry.unittest_util import options_for_unittests 11 from telemetry.unittest_util import options_for_unittests
12 from telemetry.unittest_util import page_test_test_case 12 from telemetry.unittest_util import page_test_test_case
13 13
14 14
15 class ScreenshotUnitTest(page_test_test_case.PageTestTestCase): 15 class ScreenshotUnitTest(page_test_test_case.PageTestTestCase):
16 def setUp(self): 16 def setUp(self):
17 self._options = options_for_unittests.GetCopy() 17 self._options = options_for_unittests.GetCopy()
18 self._options.png_outdir = tempfile.mkdtemp('_png_test') 18 self._png_outdir = tempfile.mkdtemp('_png_test')
19 19
20 def tearDown(self): 20 def tearDown(self):
21 shutil.rmtree(self._options.png_outdir) 21 shutil.rmtree(self._png_outdir)
22 22
23 @benchmark.Disabled('win') # http://crbug.com/386572 23 @benchmark.Disabled('win') # http://crbug.com/386572
24 def testScreenshot(self): 24 def testScreenshot(self):
25 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html') 25 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html')
26 measurement = screenshot.Screenshot() 26 measurement = screenshot.Screenshot(self._png_outdir)
27 results = self.RunMeasurement(measurement, ps, options=self._options) 27 results = self.RunMeasurement(measurement, ps, options=self._options)
28 if results.failures: 28 if results.failures:
29 logging.warning(str(results.failures)) 29 logging.warning(str(results.failures))
30 return 30 return
31 31
32 saved_picture_count = results.FindAllPageSpecificValuesNamed( 32 saved_picture_count = results.FindAllPageSpecificValuesNamed(
33 'saved_picture_count') 33 'saved_picture_count')
34 self.assertEquals(len(saved_picture_count), 1) 34 self.assertEquals(len(saved_picture_count), 1)
35 self.assertGreater(saved_picture_count[0].GetRepresentativeNumber(), 0) 35 self.assertGreater(saved_picture_count[0].GetRepresentativeNumber(), 0)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698