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

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: 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.py
diff --git a/tools/telemetry/telemetry/core/tab.py b/tools/telemetry/telemetry/core/tab.py
index 2ecccfd211e034ed36dd7244e20b3a938bc17c89..0f0c2d8dee239906afaffa8467ac37a14d147592 100644
--- a/tools/telemetry/telemetry/core/tab.py
+++ b/tools/telemetry/telemetry/core/tab.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from telemetry.core import bitmap
from telemetry.core import video
from telemetry.core import web_contents
@@ -19,6 +20,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 +89,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 +111,12 @@ class Tab(web_contents.WebContents):
});
});
})();
- """ % (color.r, color.g, color.b, color.a, int(color)))
+ """ % (color[2], color[1], color[0], 255, bitmap.BGRAColorAsInt(color)))
self.WaitForJavaScriptExpression(
- '!!window.__telemetry_screen_%d' % int(color), 5)
+ '!!window.__telemetry_screen_%d' % bitmap.BGRAColorAsInt(color), 5)
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 +128,7 @@ class Tab(web_contents.WebContents):
});
});
})();
- """ % (int(color), int(color)))
+ """ % (bitmap.BGRAColorAsInt(color), bitmap.BGRAColorAsInt(color)))
self.WaitForJavaScriptExpression(
'!window.__telemetry_screen_%d' % int(color), 5)

Powered by Google App Engine
This is Rietveld 408576698