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

Unified Diff: chrome/test/data/extensions/api_test/automation/tests/desktop/load_tabs.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 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
index 90e1711b2ef0422bf505be8f7aa01e1f659b12bb..6986a7ab7dac0f5b98f42e61faa0d8f26bbb7b51 100644
--- 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
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+var html = '<button>alpha</button><input type="text">hello</input>';
+
function getAllWebViews() {
function findAllWebViews(node, nodes) {
if (node.role == chrome.automation.RoleType.webView)
@@ -16,38 +18,39 @@ function getAllWebViews() {
var webViews = [];
findAllWebViews(rootNode, webViews);
return webViews;
-};
+}
var allTests = [
function testLoadTabs() {
- var webViews = getAllWebViews();
- assertEq(2, webViews.length);
- var subroot = webViews[1].firstChild;
- assertEq(webViews[1], subroot.parent);
- assertEq(subroot, subroot.parent.children[0]);
- 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();
+ runWithDocument(html, function() {
+ var webViews = getAllWebViews();
+ assertEq(2, webViews.length);
+ var subroot = webViews[1].firstChild;
+ assertEq(webViews[1], subroot.parent);
+ assertEq(subroot, subroot.parent.children[0]);
+ 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 webViews = getAllWebViews();
- var subroot = webViews[1].firstChild;
-
- rootNode.addEventListener(chrome.automation.EventType.focus,
- function(evt) {
- assertEq(button, evt.target);
- chrome.test.succeed();
- },
- false);
-
- button = subroot.firstChild.firstChild;
- button.focus();
+ runWithDocument(html, function(subroot) {
+ var button = null;
+
+ rootNode.addEventListener(chrome.automation.EventType.focus,
+ function(evt) {
+ assertEq(button, evt.target);
+ chrome.test.succeed();
+ },
+ false);
+
+ button = subroot.firstChild.firstChild;
+ button.focus();
+ });
}
];
-setupAndRunTests(allTests,
- '<button>alpha</button><input type="text">hello</input>');
+setUpAndRunTests(allTests);

Powered by Google App Engine
This is Rietveld 408576698