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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/testing/chromevox_e2e_test_base.js

Issue 908853004: Revert of Reland #2: Ensure WebView notifies desktop automation on creation, destruction, and change Original (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 GEN_INCLUDE([ 5 GEN_INCLUDE([
6 'chrome/browser/resources/chromeos/chromevox/testing/common.js']); 6 'chrome/browser/resources/chromeos/chromevox/testing/common.js']);
7 7
8 /** 8 /**
9 * Base test fixture for ChromeVox end to end tests. 9 * Base test fixture for ChromeVox end to end tests.
10 * 10 *
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 base::Closure load_cb = 51 base::Closure load_cb =
52 base::Bind(&chromeos::AccessibilityManager::EnableSpokenFeedback, 52 base::Bind(&chromeos::AccessibilityManager::EnableSpokenFeedback,
53 base::Unretained(chromeos::AccessibilityManager::Get()), 53 base::Unretained(chromeos::AccessibilityManager::Get()),
54 true, 54 true,
55 ui::A11Y_NOTIFICATION_NONE); 55 ui::A11Y_NOTIFICATION_NONE);
56 WaitForExtension(extension_misc::kChromeVoxExtensionId, load_cb); 56 WaitForExtension(extension_misc::kChromeVoxExtensionId, load_cb);
57 */}); 57 */});
58 }, 58 },
59 59
60 /** 60 /**
61 * Launch a new tab, wait until tab status complete, then run callback. 61 * Run a test with the specified HTML snippet loaded.
62 * @param {function() : void} doc Snippet wrapped inside of a function. 62 * @param {function() : void} doc Snippet wrapped inside of a function.
63 * @param {function()} callback Called once the document is ready. 63 * @param {function()} callback Called once the document is ready.
64 */ 64 */
65 runWithLoadedTab: function(doc, callback) { 65 runWithDocument: function(doc, callback) {
66 this.launchNewTabWithDoc(doc, function(tab) {
67 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo) {
68 if (tabId == tab.id && changeInfo.status == 'complete') {
69 callback(tabId);
70 }
71 });
72 });
73 },
74
75 /**
76 * Launches the given document in a new tab.
77 * @param {function() : void} doc Snippet wrapped inside of a function.
78 * @param {function()} opt_callback Called once the document is created.
79 */
80 runWithTab: function(doc, opt_callback) {
81 var docString = TestUtils.extractHtmlFromCommentEncodedString(doc); 66 var docString = TestUtils.extractHtmlFromCommentEncodedString(doc);
82 var url = 'data:text/html,<!doctype html>' + 67 var url = 'data:text/html,<!doctype html>' +
83 docString + 68 docString +
84 '<!-- chromevox_next_test -->'; 69 '<!-- chromevox_next_test -->';
85 var createParams = { 70 var createParams = {
86 active: true, 71 active: true,
87 url: url 72 url: url
88 }; 73 };
89 chrome.tabs.create(createParams, opt_callback); 74 chrome.tabs.create(createParams, function(tab) {
75 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo) {
76 if (tabId == tab.id && changeInfo.status == 'complete') {
77 callback(tabId);
78 }
79 });
80 });
90 }, 81 },
91 82
92 /** 83 /**
93 * Send a key to the page. 84 * Send a key to the page.
94 * @param {number} tabId Of the page. 85 * @param {number} tabId Of the page.
95 * @param {string} key Name of the key (e.g. Down). 86 * @param {string} key Name of the key (e.g. Down).
96 * @param {string} elementQueryString 87 * @param {string} elementQueryString
97 */ 88 */
98 sendKeyToElement: function(tabId, key, elementQueryString) { 89 sendKeyToElement: function(tabId, key, elementQueryString) {
99 var code = TestUtils.extractHtmlFromCommentEncodedString(function() {/*! 90 var code = TestUtils.extractHtmlFromCommentEncodedString(function() {/*!
(...skipping 18 matching lines...) Expand all
118 * @param {string} testName Test name. 109 * @param {string} testName Test name.
119 * @param {function} testFunction The test impl. 110 * @param {function} testFunction The test impl.
120 */ 111 */
121 function SYNC_TEST_F(testFixture, testName, testFunction) { 112 function SYNC_TEST_F(testFixture, testName, testFunction) {
122 var wrappedTestFunction = function() { 113 var wrappedTestFunction = function() {
123 testFunction.call(this); 114 testFunction.call(this);
124 testDone([true, '']); 115 testDone([true, '']);
125 }; 116 };
126 TEST_F(testFixture, testName, wrappedTestFunction); 117 TEST_F(testFixture, testName, wrappedTestFunction);
127 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698