OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 import os |
| 6 import sys |
| 7 |
| 8 sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
| 9 |
| 10 import telemetry |
| 11 |
| 12 def Main(args): |
| 13 options = telemetry.BrowserOptions() |
| 14 parser = options.CreateParser('telemetry_extension_test.py') |
| 15 options, args = parser.parse_args(args) |
| 16 |
| 17 browser_to_create = telemetry.FindBrowser(options) |
| 18 assert browser_to_create |
| 19 with browser_to_create.Create() as b: |
| 20 with b.ConnectToExtensionPage("aapnijgdinlhnhlmodcfapnahmbfebeb") as ext: |
| 21 create_properties = { 'url':'http://www.google.com' } |
| 22 arguments = ext.RunMethod("chrome.tabs.create", |
| 23 create_properties) |
| 24 print arguments |
| 25 |
| 26 create_properties = { 'url':'http://www.cnn.com' } |
| 27 results = ext.RunMethodWithEvents( |
| 28 ['chrome.tabs.onCreated', 'chrome.tabs.onHighlighted'], |
| 29 'chrome.tabs.create', |
| 30 create_properties) |
| 31 print results |
| 32 |
| 33 return 0 |
| 34 |
| 35 if __name__ == '__main__': |
| 36 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |