| 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..7e5b3e2f41e347d0c96df476f02cfcece72b96b6
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.js
|
| @@ -0,0 +1,59 @@
|
| +// 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 second = webAreas[1];
|
| +
|
| + second.load(function(actualSubroot) {
|
| + var subroot = second.firstChild();
|
| + assertEq(chrome.automation.RoleType.rootWebArea, subroot.role);
|
| + 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 second = webAreas[1];
|
| + rootNode.addEventListener(chrome.automation.EventType.focus,
|
| + function(evt) {
|
| + assertEq(button, evt.target);
|
| + chrome.test.succeed();
|
| + },
|
| + false);
|
| +
|
| + second.load(function(subroot) {
|
| + button = subroot.firstChild().firstChild();
|
| + button.focus();
|
| + });
|
| + }
|
| +];
|
| +
|
| +setupAndRunTests(allTests,
|
| + '<button>alpha</button><input type="text">hello</input>');
|
|
|