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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 function getAllWebAreas() {
6 function findAllWebAreas(node, nodes) {
7 if (node.role == chrome.automation.RoleType.webArea)
8 nodes.push(node);
9
10 var children = node.children();
11 for (var i = 0; i < children.length; i++) {
12 var child = findAllWebAreas(children[i], nodes);
13 }
14 }
15
16 var webAreas = [];
17 findAllWebAreas(rootNode, webAreas);
18 return webAreas;
19 };
20
21 var allTests = [
22 function testLoadTabs() {
23 var webAreas = getAllWebAreas();
24 assertEq(2, webAreas.length);
25 var second = webAreas[1];
26
27 second.load(function(actualSubroot) {
28 var subroot = second.firstChild();
29 assertEq(chrome.automation.RoleType.rootWebArea, subroot.role);
30 assertEq(subroot, actualSubroot);
31 var button = subroot.firstChild().firstChild();
32 assertEq(chrome.automation.RoleType.button, button.role);
33
34 var input = subroot.firstChild().lastChild().previousSibling();
35 assertEq(chrome.automation.RoleType.textField, input.role);
36 chrome.test.succeed();
37 });
38 },
39
40 function testSubevents() {
41 var button = null;
42 var webAreas = getAllWebAreas();
43 var second = webAreas[1];
44 rootNode.addEventListener(chrome.automation.EventType.focus,
45 function(evt) {
46 assertEq(button, evt.target);
47 chrome.test.succeed();
48 },
49 false);
50
51 second.load(function(subroot) {
52 button = subroot.firstChild().firstChild();
53 button.focus();
54 });
55 }
56 ];
57
58 setupAndRunTests(allTests,
59 '<button>alpha</button><input type="text">hello</input>');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698