Index: telemetry/telemetry/internal/actions/pinch.py |
diff --git a/telemetry/telemetry/internal/actions/pinch.py b/telemetry/telemetry/internal/actions/pinch.py |
index c1d76b6647efb6f36f42741e8c05ecc8aef1ee15..223a5cc02c0fd6f0b37a1f805cc270cab543682e 100644 |
--- a/telemetry/telemetry/internal/actions/pinch.py |
+++ b/telemetry/telemetry/internal/actions/pinch.py |
@@ -1,9 +1,9 @@ |
# Copyright 2013 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-import os |
from telemetry.internal.actions import page_action |
+from telemetry.internal.actions import utils |
class PinchAction(page_action.PageAction): |
@@ -27,10 +27,8 @@ class PinchAction(page_action.PageAction): |
self._element_function = 'document.body' |
def WillRunAction(self, tab): |
- for js_file in ['gesture_common.js', 'pinch.js']: |
- with open(os.path.join(os.path.dirname(__file__), js_file)) as f: |
- js = f.read() |
- tab.ExecuteJavaScript(js) |
+ utils.InjectJavaScript(tab, 'gesture_common.js') |
+ utils.InjectJavaScript(tab, 'pinch.js') |
# Fail if browser doesn't support synthetic pinch gestures. |
if not tab.EvaluateJavaScript('window.__PinchAction_SupportedByBrowser()'): |