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

Unified Diff: tools/telemetry/telemetry/core/tab_unittest.py

Issue 668753002: [Telemetry] Migrate bitmap.py from bitmaptools.cc to numpy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make GetBoundingBox just, like, WAY too fast Created 6 years, 2 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/telemetry/telemetry/core/tab_unittest.py
diff --git a/tools/telemetry/telemetry/core/tab_unittest.py b/tools/telemetry/telemetry/core/tab_unittest.py
index 95730322d89642164b6e392d11665c1b21e4ea22..85caa36be176d6c29dcc9007b60e282cf9b24737 100644
--- a/tools/telemetry/telemetry/core/tab_unittest.py
+++ b/tools/telemetry/telemetry/core/tab_unittest.py
@@ -21,6 +21,7 @@ def _IsDocumentVisible(tab):
class FakePlatformBackend(object):
+
def __init__(self):
self.platform = FakePlatform()
@@ -32,6 +33,7 @@ class FakePlatformBackend(object):
class FakePlatform(object):
+
def __init__(self):
self._is_video_capture_running = False
@@ -49,6 +51,7 @@ class FakePlatform(object):
class TabTest(tab_test_case.TabTestCase):
+
def testNavigateAndWaitForCompleteState(self):
self._tab.Navigate(self.UrlOfUnittestFile('blank.html'))
self._tab.WaitForDocumentReadyStateToBeComplete()
@@ -170,6 +173,7 @@ class TabTest(tab_test_case.TabTestCase):
class GpuTabTest(tab_test_case.TabTestCase):
+
@classmethod
def CustomizeBrowserOptions(cls, options):
options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
@@ -186,9 +190,10 @@ class GpuTabTest(tab_test_case.TabTestCase):
screenshot = self._tab.Screenshot(5)
assert screenshot
- screenshot.GetPixelColor(0 * pixel_ratio, 0 * pixel_ratio).AssertIsRGB(
- 0, 255, 0, tolerance=2)
- screenshot.GetPixelColor(31 * pixel_ratio, 31 * pixel_ratio).AssertIsRGB(
- 0, 255, 0, tolerance=2)
- screenshot.GetPixelColor(32 * pixel_ratio, 32 * pixel_ratio).AssertIsRGB(
- 255, 255, 255, tolerance=2)
+ self.assertTrue(bitmap.ColorsAreEqual(
+ screenshot.image[0 * pixel_ratio][0 * pixel_ratio], (0, 255, 0), 2))
+ self.assertTrue(bitmap.ColorsAreEqual(
+ screenshot.image[31 * pixel_ratio][31 * pixel_ratio], (0, 255, 0), 2))
+ self.assertTrue(bitmap.ColorsAreEqual(
+ screenshot.image[32 * pixel_ratio][32 * pixel_ratio],
+ (255, 255, 255), 2))

Powered by Google App Engine
This is Rietveld 408576698