| Index: telemetry/telemetry/internal/browser/tab.py
|
| diff --git a/telemetry/telemetry/internal/browser/tab.py b/telemetry/telemetry/internal/browser/tab.py
|
| index 3c346e9e4a1558ef537c1b1901417ebc77dd453c..cfedeba21291edd8b0da5af7678ba7ff9d53e538 100644
|
| --- a/telemetry/telemetry/internal/browser/tab.py
|
| +++ b/telemetry/telemetry/internal/browser/tab.py
|
| @@ -133,29 +133,28 @@
|
| exceptions.TimeoutException
|
| exceptions.DevtoolsTargetCrashException
|
| """
|
| - screen_save = 'window.__telemetry_screen_%d' % int(color)
|
| - self.ExecuteJavaScript2("""
|
| - (function() {
|
| - var screen = document.createElement('div');
|
| - screen.style.background = {{ color }};
|
| - 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);
|
| + # TODO(catapult:#3028): Fix interpolation of JavaScript values.
|
| + self.ExecuteJavaScript("""
|
| + (function() {
|
| + var screen = document.createElement('div');
|
| + screen.style.background = 'rgba(%d, %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() {
|
| requestAnimationFrame(function() {
|
| - requestAnimationFrame(function() {
|
| - {{ @screen_save }} = screen;
|
| - });
|
| + window.__telemetry_screen_%d = screen;
|
| });
|
| - })();
|
| - """,
|
| - color='rgba(%d, %d, %d, %d)' % (color.r, color.g, color.b, color.a),
|
| - screen_save=screen_save)
|
| - self.WaitForJavaScriptCondition2(
|
| - '!!{{ @screen_save }}', screen_save=screen_save, timeout=5)
|
| + });
|
| + })();
|
| + """ % (color.r, color.g, color.b, color.a, int(color)))
|
| + # TODO(catapult:#3028): Fix interpolation of JavaScript values.
|
| + self.WaitForJavaScriptExpression(
|
| + '!!window.__telemetry_screen_%d' % int(color), 5)
|
|
|
| def ClearHighlight(self, color):
|
| """Clears a highlight of the given bitmap.RgbaColor.
|
| @@ -166,21 +165,22 @@
|
| exceptions.TimeoutException
|
| exceptions.DevtoolsTargetCrashException
|
| """
|
| - screen_save = 'window.__telemetry_screen_%d' % int(color)
|
| - self.ExecuteJavaScript2("""
|
| - (function() {
|
| - document.body.removeChild({{ @screen_save }});
|
| + # TODO(catapult:#3028): Fix interpolation of JavaScript values.
|
| + self.ExecuteJavaScript("""
|
| + (function() {
|
| + document.body.removeChild(window.__telemetry_screen_%d);
|
| + requestAnimationFrame(function() {
|
| requestAnimationFrame(function() {
|
| - requestAnimationFrame(function() {
|
| - {{ @screen_save }} = null;
|
| - console.time('__ClearHighlight.video_capture_start');
|
| - console.timeEnd('__ClearHighlight.video_capture_start');
|
| - });
|
| + window.__telemetry_screen_%d = null;
|
| + console.time('__ClearHighlight.video_capture_start');
|
| + console.timeEnd('__ClearHighlight.video_capture_start');
|
| });
|
| - })();
|
| - """, screen_save=screen_save)
|
| - self.WaitForJavaScriptCondition2(
|
| - '!{{ @screen_save }}', screen_save=screen_save, timeout=5)
|
| + });
|
| + })();
|
| + """ % (int(color), int(color)))
|
| + # TODO(catapult:#3028): Fix interpolation of JavaScript values.
|
| + self.WaitForJavaScriptExpression(
|
| + '!window.__telemetry_screen_%d' % int(color), 5)
|
|
|
| def StartVideoCapture(self, min_bitrate_mbps,
|
| highlight_bitmap=video.HIGHLIGHT_ORANGE_FRAME):
|
| @@ -257,7 +257,7 @@
|
| errors.DeviceUnresponsiveError
|
| """
|
| self.browser.platform.FlushDnsCache()
|
| - self.ExecuteJavaScript2("""
|
| + self.ExecuteJavaScript("""
|
| if (window.chrome && chrome.benchmarking &&
|
| chrome.benchmarking.clearCache) {
|
| chrome.benchmarking.clearCache();
|
|
|