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

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: Fix UAF 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 getAllWebViews() {
6 function findAllWebViews(node, nodes) {
7 if (node.role == chrome.automation.RoleType.webView)
8 nodes.push(node);
9
10 var children = node.children();
11 for (var i = 0; i < children.length; i++) {
12 var child = findAllWebViews(children[i], nodes);
13 }
14 }
15
16 var webViews = [];
17 findAllWebViews(rootNode, webViews);
18 return webViews;
19 };
20
21 var allTests = [
22 function testLoadTabs() {
23 var webViews = getAllWebViews();
24 assertEq(2, webViews.length);
25
26 // Test spins up more quickly than the load; listen for the childrenChanged
27 // event.
28 webViews[1].addEventListener(chrome.automation.EventType.childrenChanged,
29 function(evt) {
30 var subroot = webViews[1].firstChild();
31 assertEq(evt.target, subroot.parent());
32
33 var button = subroot.firstChild().firstChild();
34 assertEq(chrome.automation.RoleType.button, button.role);
35
36 var input = subroot.firstChild().lastChild().previousSibling();
37 assertEq(chrome.automation.RoleType.textField, input.role);
38 chrome.test.succeed();
39 }, true);
40 },
41
42 function testSubevents() {
43 var button = null;
44 var webViews = getAllWebViews();
45 var subroot = webViews[1].firstChild();
46
47 rootNode.addEventListener(chrome.automation.EventType.focus,
48 function(evt) {
49 assertEq(button, evt.target);
50 chrome.test.succeed();
51 },
52 false);
53
54 button = subroot.firstChild().firstChild();
55 button.focus();
56 }
57 ];
58
59 setupAndRunTests(allTests,
60 '<button>alpha</button><input type="text">hello</input>');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698