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

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

Issue 469593002: [telemetry] Create BrowserTestCase to reuse the browser for browser_unittest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update page_test_test_case references in tools/perf/ Created 6 years, 4 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 | Annotate | Revision Log
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.page import page_test 11 from telemetry.page import page_test
12 from telemetry.testing import page_test_test_case
13 from telemetry.unittest import options_for_unittests 12 from telemetry.unittest import options_for_unittests
13 from telemetry.unittest import page_test_test_case
14 14
15 15
16 class ScreenshotUnitTest(page_test_test_case.PageTestTestCase): 16 class ScreenshotUnitTest(page_test_test_case.PageTestTestCase):
17 def setUp(self): 17 def setUp(self):
18 self._options = options_for_unittests.GetCopy() 18 self._options = options_for_unittests.GetCopy()
19 self._options.png_outdir = tempfile.mkdtemp('_png_test') 19 self._options.png_outdir = tempfile.mkdtemp('_png_test')
20 20
21 def tearDown(self): 21 def tearDown(self):
22 shutil.rmtree(self._options.png_outdir) 22 shutil.rmtree(self._options.png_outdir)
23 23
24 @benchmark.Disabled('win') # http://crbug.com/386572 24 @benchmark.Disabled('win') # http://crbug.com/386572
25 def testScreenshot(self): 25 def testScreenshot(self):
26 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html') 26 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html')
27 measurement = screenshot.Screenshot() 27 measurement = screenshot.Screenshot()
28 try: 28 try:
29 results = self.RunMeasurement(measurement, ps, options=self._options) 29 results = self.RunMeasurement(measurement, ps, options=self._options)
30 except page_test.TestNotSupportedOnPlatformFailure as failure: 30 except page_test.TestNotSupportedOnPlatformFailure as failure:
31 logging.warning(str(failure)) 31 logging.warning(str(failure))
32 return 32 return
33 33
34 saved_picture_count = results.FindAllPageSpecificValuesNamed( 34 saved_picture_count = results.FindAllPageSpecificValuesNamed(
35 'saved_picture_count') 35 'saved_picture_count')
36 self.assertEquals(len(saved_picture_count), 1) 36 self.assertEquals(len(saved_picture_count), 1)
37 self.assertGreater(saved_picture_count[0].GetRepresentativeNumber(), 0) 37 self.assertGreater(saved_picture_count[0].GetRepresentativeNumber(), 0)
OLDNEW
« no previous file with comments | « tools/perf/measurements/repaint_unittest.py ('k') | tools/perf/measurements/skpicture_printer_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698