Index: chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js |
diff --git a/chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js b/chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..550b7276073d45aeb27605b558f0670e1ddfe07b |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js |
@@ -0,0 +1,61 @@ |
+// Copyright 2014 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. |
+ |
+function getAllWebViews() { |
+ function findAllWebViews(node, nodes) { |
+ if (node.role == chrome.automation.RoleType.webView) |
+ nodes.push(node); |
+ |
+ var children = node.children(); |
+ for (var i = 0; i < children.length; i++) { |
+ var child = findAllWebViews(children[i], nodes); |
+ } |
+ } |
+ |
+ var webViews = []; |
+ findAllWebViews(rootNode, webViews); |
+ return webViews; |
+}; |
+ |
+var allTests = [ |
+ function testLoadTabs() { |
+ var webViews = getAllWebViews(); |
+ assertEq(2, webViews.length); |
+ |
+ // Test spins up more quickly than the load; listen for the childrenChanged |
+ // event. |
+ webViews[1].addEventListener(chrome.automation.EventType.childrenChanged, |
+ function(evt) { |
+ var subroot = webViews[1].firstChild(); |
+ assertEq(chrome.automation.RoleType.rootWebArea, subroot.role); |
+ assertEq(evt.target, subroot.parent()); |
aboxhall
2014/11/03 19:40:18
Do we not want to test this any more?
David Tseng
2014/11/03 19:55:51
Exported toJSON to get around circular stringifica
David Tseng
2014/11/03 19:55:51
We can't re: JSON.stringify on that parent node re
|
+ |
+ var button = subroot.firstChild().firstChild(); |
+ assertEq(chrome.automation.RoleType.button, button.role); |
+ |
+ var input = subroot.firstChild().lastChild().previousSibling(); |
+ assertEq(chrome.automation.RoleType.textField, input.role); |
+ chrome.test.succeed(); |
+ }, true); |
+ }, |
+ |
+ function testSubevents() { |
+ var button = null; |
+ var webViews = getAllWebViews(); |
+ var subroot = webViews[1].firstChild(); |
+ |
+ rootNode.addEventListener(chrome.automation.EventType.focus, |
+ function(evt) { |
+ assertEq(button, evt.target); |
+ chrome.test.succeed(); |
+ }, |
+ false); |
+ |
+ button = subroot.firstChild().firstChild(); |
+ button.focus(); |
+ } |
+]; |
+ |
+setupAndRunTests(allTests, |
+ '<button>alpha</button><input type="text">hello</input>'); |