Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import os | |
| 6 | |
| 7 class TracingJsExecutor: | |
| 8 def __init__(self, js_host, win_idx = 0, tab_idx = 0): | |
|
nduca
2012/07/20 07:13:13
I think you should just put this file into the tes
| |
| 9 self._js_host = js_host | |
| 10 self._win_idx = win_idx | |
| 11 self._tab_idx = tab_idx | |
| 12 | |
| 13 def ExecuteJavascript(self, js): | |
| 14 return self._js_host.ExecuteJavascript( | |
| 15 js = js, | |
| 16 windex = self._win_idx, | |
| 17 tab_index = self._tab_idx | |
| 18 ) | |
| 19 | |
| 20 def ExecuteJavascriptFile(self, fileName): | |
| 21 fileJs, fd = (None, None) | |
| 22 try: | |
| 23 fd = open(os.path.join(os.path.dirname(__file__), fileName), "r") | |
| 24 fileJs = fd.read() | |
| 25 finally: | |
| 26 if fd: | |
| 27 fd.close() | |
| 28 return self.ExecuteJavascript(fileJs); | |
| OLD | NEW |