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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: tools/perf/measurements/pixel_diff_unittest.py
diff --git a/tools/perf/measurements/pixel_diff_unittest.py b/tools/perf/measurements/pixel_diff_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..4e0f3d221da2c3a8081e195d563ae2ba6132f9a5
--- /dev/null
+++ b/tools/perf/measurements/pixel_diff_unittest.py
@@ -0,0 +1,34 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import shutil
wkorman 2017/06/07 20:15:12 +1 blank above
+import tempfile
+
+from telemetry.testing import options_for_unittests
+from telemetry.testing import page_test_test_case
+
+from measurements import pixel_diff
+
+class PixelDiffUnitTest(page_test_test_case.PageTestTestCase):
+
+ def setUp(self):
+ self._options = options_for_unittests.GetCopy()
+ self._png_outdir = tempfile.mkdtemp('_png_test')
+
+ def tearDown(self):
+ shutil.rmtree(self._png_outdir)
+
+ def testPixelDiff(self):
+ ps = self.CreateStorySetFromFileInUnittestDataDir('blank.html')
wkorman 2017/06/07 20:15:12 Rename ps -> page_set for better understandability
+ measurement = pixel_diff.PixelDiff(self._png_outdir)
+ results = self.RunMeasurement(measurement, ps, options=self._options)
+
+ # Screenshots are not supported on all platforms
wkorman 2017/06/07 20:15:12 We should make sure this test fails somehow if for
+ if results.failures:
+ assert 'not supported' in results.failures[0].exc_info[1].message
+ return
+
+ saved_picture_count = results.FindAllPageSpecificValuesNamed(
+ 'saved_picture_count')
+ self.assertEquals(len(saved_picture_count), 1)
+ self.assertGreater(saved_picture_count[0].GetRepresentativeNumber(), 0)
« 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