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

Unified Diff: tools/telemetry/telemetry/core/tab.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: Simplify FromRGBPixels 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.py
diff --git a/tools/telemetry/telemetry/core/tab.py b/tools/telemetry/telemetry/core/tab.py
index 2ecccfd211e034ed36dd7244e20b3a938bc17c89..51970c3b44c4523311b8ef734e5579155f04206b 100644
--- a/tools/telemetry/telemetry/core/tab.py
+++ b/tools/telemetry/telemetry/core/tab.py
@@ -19,6 +19,7 @@ class Tab(web_contents.WebContents):
# Evaluates 1+1 in the tab's JavaScript context.
tab.Evaluate('1+1')
"""
+
def __init__(self, inspector_backend, backend_list):
super(Tab, self).__init__(inspector_backend, backend_list)
@@ -87,7 +88,7 @@ class Tab(web_contents.WebContents):
return self.browser.platform.CanCaptureVideo()
def Highlight(self, color):
- """Synchronously highlights entire tab contents with the given RgbaColor.
+ """Synchronously highlights entire tab contents with the given color.
TODO(tonyg): It is possible that the z-index hack here might not work for
all pages. If this happens, DevTools also provides a method for this.
@@ -109,12 +110,14 @@ class Tab(web_contents.WebContents):
});
});
})();
- """ % (color.r, color.g, color.b, color.a, int(color)))
+ """ % (color[2], color[1], color[0], 255,
+ int((color[2] << 16) | (color[1] << 8) | color[0])))
self.WaitForJavaScriptExpression(
- '!!window.__telemetry_screen_%d' % int(color), 5)
+ '!!window.__telemetry_screen_%d' %
+ int((color[2] << 16) | (color[1] << 8) | color[0]), 5)
tonyg 2014/10/21 16:12:57 The inlined bit shifting makes me miss some sort o
mthiesse 2014/10/22 15:33:10 Done.
def ClearHighlight(self, color):
- """Clears a highlight of the given bitmap.RgbaColor."""
+ """Clears a highlight of the given color."""
self.ExecuteJavaScript("""
(function() {
document.body.removeChild(window.__telemetry_screen_%d);
@@ -126,7 +129,8 @@ class Tab(web_contents.WebContents):
});
});
})();
- """ % (int(color), int(color)))
+ """ % (int((color[2] << 16) | (color[1] << 8) | color[0]),
+ int((color[2] << 16) | (color[1] << 8) | color[0])))
self.WaitForJavaScriptExpression(
'!window.__telemetry_screen_%d' % int(color), 5)

Powered by Google App Engine
This is Rietveld 408576698