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

Side by Side Diff: chrome/test/data/extensions/api_test/automation/tests/desktop/actions.js

Issue 1365433002: Add setSelection function to automation API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nobrailleautostartintests
Patch Set: Change setDocumentSelection to take named arguments. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function listenOnce(node, eventType, callback, capture) {
6 var innerCallback = function() {
7 node.removeEventListener(eventType, innerCallback, capture);
8 callback();
9 };
10 node.addEventListener(eventType, innerCallback, capture);
11 };
12
13 var allTests = [ 5 var allTests = [
14 function testDoDefault() { 6 function testDoDefault() {
15 var firstTextField = findAutomationNode(rootNode, 7 var firstTextField = findAutomationNode(rootNode,
16 function(node) { 8 function(node) {
17 return node.role == 'textField'; 9 return node.role == 'textField';
18 }); 10 });
19 assertTrue(!!firstTextField); 11 assertTrue(!!firstTextField);
20 listenOnce(firstTextField, EventType.focus, function(e) { 12 listenOnce(firstTextField, EventType.focus, function(e) {
21 chrome.test.succeed(); 13 chrome.test.succeed();
22 }, true); 14 }, true);
(...skipping 24 matching lines...) Expand all
47 function testContextMenu() { 39 function testContextMenu() {
48 var addressBar = rootNode.find({role: 'textField'}); 40 var addressBar = rootNode.find({role: 'textField'});
49 listenOnce(rootNode, EventType.menuStart, function(e) { 41 listenOnce(rootNode, EventType.menuStart, function(e) {
50 addressBar.showContextMenu(); 42 addressBar.showContextMenu();
51 chrome.test.succeed(); 43 chrome.test.succeed();
52 }, true); 44 }, true);
53 addressBar.showContextMenu(); 45 addressBar.showContextMenu();
54 } 46 }
55 ]; 47 ];
56 48
57 setupAndRunTests(allTests); 49 setUpAndRunTests(allTests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698