Index: tools/telemetry/examples/telemetry_extension_test.py |
diff --git a/tools/telemetry/examples/telemetry_extension_test.py b/tools/telemetry/examples/telemetry_extension_test.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..0efcb545407b3829c410550e353c7cbfee4f0d48 |
--- /dev/null |
+++ b/tools/telemetry/examples/telemetry_extension_test.py |
@@ -0,0 +1,36 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2012 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 |
+import sys |
+ |
+sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
+ |
+import telemetry |
+ |
+def Main(args): |
+ options = telemetry.BrowserOptions() |
+ parser = options.CreateParser('telemetry_extension_test.py') |
nduca
2012/12/07 19:23:47
should there be an extension as part of this? just
zel
2012/12/12 21:03:42
will ping you about this in person
|
+ options, args = parser.parse_args(args) |
+ |
+ browser_to_create = telemetry.FindBrowser(options) |
+ assert browser_to_create |
+ with browser_to_create.Create() as b: |
+ with b.ConnectToExtensionPage("aapnijgdinlhnhlmodcfapnahmbfebeb") as ext: |
+ create_properties = { 'url':'http://www.google.com' } |
+ arguments = ext.RunMethod("chrome.tabs.create", |
+ create_properties) |
+ print arguments |
+ |
+ create_properties = { 'url':'http://www.cnn.com' } |
+ results = ext.RunMethodWithEvents( |
+ ['chrome.tabs.onCreated', 'chrome.tabs.onHighlighted'], |
+ 'chrome.tabs.create', |
+ create_properties) |
+ print results |
+ |
+ return 0 |
+ |
+if __name__ == '__main__': |
+ sys.exit(Main(sys.argv[1:])) |