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

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: Get test to pass. Created 6 years, 2 months 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..047aceff795940a01e2178335a24bc2268ca2a79
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js
@@ -0,0 +1,62 @@
+// 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 getAllWebAreas() {
+ function findAllWebAreas(node, nodes) {
+ if (node.role == chrome.automation.RoleType.webArea)
+ nodes.push(node);
+
+ var children = node.children();
+ for (var i = 0; i < children.length; i++) {
+ var child = findAllWebAreas(children[i], nodes);
+ }
+ }
+
+ var webAreas = [];
+ findAllWebAreas(rootNode, webAreas);
+ return webAreas;
+};
+
+var allTests = [
+ function testLoadTabs() {
+ var webAreas = getAllWebAreas();
+ assertEq(2, webAreas.length);
+
+ var subroot = webAreas[1].firstChild();
+ assertEq(chrome.automation.RoleType.rootWebArea, subroot.role);
+
+ subroot.load(function(actualSubroot) {
+ assertEq(chrome.automation.RoleType.rootWebArea, subroot.role);
+ assertTrue(subroot.loaded);
+ assertEq(subroot, actualSubroot);
+ 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();
+ });
+ },
+
+ function testSubevents() {
+ var button = null;
+ var webAreas = getAllWebAreas();
+ var subroot = webAreas[1].firstChild();
+
+ rootNode.addEventListener(chrome.automation.EventType.focus,
+ function(evt) {
+ assertEq(button, evt.target);
+ chrome.test.succeed();
+ },
+ false);
+
+ subroot.load(function(actualSubroot) {
+ button = actualSubroot.firstChild().firstChild();
+ button.focus();
+ });
+ }
+];
+
+setupAndRunTests(allTests,
+ '<button>alpha</button><input type="text">hello</input>');

Powered by Google App Engine
This is Rietveld 408576698