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

Unified Diff: tools/android/loading/device_setup.py

Issue 2672803002: [Telemetry refactor] Migrate clients to new JavaScript API (batch 3) (Closed)
Patch Set: Created 3 years, 11 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/android/loading/device_setup.py
diff --git a/tools/android/loading/device_setup.py b/tools/android/loading/device_setup.py
index fc22bdcb59e8d7db1f6f76a7ce6dc2752fdff110..27113ee681b46ac62041665a159d2425ec0e6e34 100644
--- a/tools/android/loading/device_setup.py
+++ b/tools/android/loading/device_setup.py
@@ -403,31 +403,32 @@ def RemoteSpeedIndexRecorder(device, connection, local_output_path):
# Paint the current HTML document with the ORANGE that video is detecting with
# the view-port position and size.
color = video.HIGHLIGHT_ORANGE_FRAME
- connection.ExecuteJavaScript("""
- (function() {
- var screen = document.createElement('div');
- screen.style.background = 'rgb(%d, %d, %d)';
- screen.style.position = 'fixed';
- screen.style.top = '0';
- screen.style.left = '0';
- screen.style.width = '100%%';
- screen.style.height = '100%%';
- screen.style.zIndex = '2147483638';
- document.body.appendChild(screen);
- requestAnimationFrame(function() {
+ connection.ExecuteJavaScript2("""
+ (function() {
+ var screen = document.createElement('div');
+ screen.style.background = 'rgb({{ red }}, {{ green }}, {{ blue }})';
+ screen.style.position = 'fixed';
+ screen.style.top = '0';
+ screen.style.left = '0';
+ screen.style.width = '100%';
+ screen.style.height = '100%';
+ screen.style.zIndex = '2147483638';
+ document.body.appendChild(screen);
requestAnimationFrame(function() {
- window.__speedindex_screen = screen;
+ requestAnimationFrame(function() {
+ window.__speedindex_screen = screen;
+ });
});
- });
- })();
- """ % (color.r, color.g, color.b))
+ })();
+ """,
+ red=color.r, green=color.g, blue=color.b)
connection.PollForJavaScriptExpression('!!window.__speedindex_screen', 1)
with _RemoteVideoRecorder(device, local_output_path,
megabits_per_second=_SPEED_INDEX_VIDEO_BITRATE):
# Paint the current HTML document with white so that it is not troubling the
# speed index measurement.
- connection.ExecuteJavaScript("""
+ connection.ExecuteJavaScript2("""
(function() {
requestAnimationFrame(function() {
var screen = window.__speedindex_screen;

Powered by Google App Engine
This is Rietveld 408576698