Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js

Issue 667713006: Implement automatic load of composed/embedded automation trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>');

Powered by Google App Engine
This is Rietveld 408576698