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

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

Issue 939853003: Revert of Reland #4: Ensure WebView notifies desktop automation on creation, (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 25 matching lines...) Expand all
36 #include "base/bind.h" 36 #include "base/bind.h"
37 #include "base/callback.h" 37 #include "base/callback.h"
38 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 38 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
39 #include "chrome/common/extensions/extension_constants.h" 39 #include "chrome/common/extensions/extension_constants.h"
40 */}); 40 */});
41 }, 41 },
42 42
43 /** @override */ 43 /** @override */
44 testGenPreamble: function() { 44 testGenPreamble: function() {
45 GEN_BLOCK(function() {/*! 45 GEN_BLOCK(function() {/*!
46 if (chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) {
47 chromeos::AccessibilityManager::Get()->EnableSpokenFeedback(false,
48 ui::A11Y_NOTIFICATION_NONE);
49 }
50
46 base::Closure load_cb = 51 base::Closure load_cb =
47 base::Bind(&chromeos::AccessibilityManager::EnableSpokenFeedback, 52 base::Bind(&chromeos::AccessibilityManager::EnableSpokenFeedback,
48 base::Unretained(chromeos::AccessibilityManager::Get()), 53 base::Unretained(chromeos::AccessibilityManager::Get()),
49 true, 54 true,
50 ui::A11Y_NOTIFICATION_NONE); 55 ui::A11Y_NOTIFICATION_NONE);
51 WaitForExtension(extension_misc::kChromeVoxExtensionId, load_cb); 56 WaitForExtension(extension_misc::kChromeVoxExtensionId, load_cb);
52 */}); 57 */});
53 }, 58 },
54 59
55 /** 60 /**
56 * Launch a new tab, wait until tab status complete, then run callback. 61 * Run a test with the specified HTML snippet loaded.
57 * @param {function() : void} doc Snippet wrapped inside of a function. 62 * @param {function() : void} doc Snippet wrapped inside of a function.
58 * @param {function()} callback Called once the document is ready. 63 * @param {function()} callback Called once the document is ready.
59 */ 64 */
60 runWithLoadedTab: function(doc, callback) { 65 runWithDocument: function(doc, callback) {
61 this.launchNewTabWithDoc(doc, function(tab) {
62 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo) {
63 if (tabId == tab.id && changeInfo.status == 'complete') {
64 callback(tabId);
65 }
66 });
67 });
68 },
69
70 /**
71 * Launches the given document in a new tab.
72 * @param {function() : void} doc Snippet wrapped inside of a function.
73 * @param {function()} opt_callback Called once the document is created.
74 */
75 runWithTab: function(doc, opt_callback) {
76 var docString = TestUtils.extractHtmlFromCommentEncodedString(doc); 66 var docString = TestUtils.extractHtmlFromCommentEncodedString(doc);
77 var url = 'data:text/html,<!doctype html>' + 67 var url = 'data:text/html,<!doctype html>' +
78 docString + 68 docString +
79 '<!-- chromevox_next_test -->'; 69 '<!-- chromevox_next_test -->';
80 var createParams = { 70 var createParams = {
81 active: true, 71 active: true,
82 url: url 72 url: url
83 }; 73 };
84 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 });
85 }, 81 },
86 82
87 /** 83 /**
88 * Send a key to the page. 84 * Send a key to the page.
89 * @param {number} tabId Of the page. 85 * @param {number} tabId Of the page.
90 * @param {string} key Name of the key (e.g. Down). 86 * @param {string} key Name of the key (e.g. Down).
91 * @param {string} elementQueryString 87 * @param {string} elementQueryString
92 */ 88 */
93 sendKeyToElement: function(tabId, key, elementQueryString) { 89 sendKeyToElement: function(tabId, key, elementQueryString) {
94 var code = TestUtils.extractHtmlFromCommentEncodedString(function() {/*! 90 var code = TestUtils.extractHtmlFromCommentEncodedString(function() {/*!
(...skipping 18 matching lines...) Expand all
113 * @param {string} testName Test name. 109 * @param {string} testName Test name.
114 * @param {function} testFunction The test impl. 110 * @param {function} testFunction The test impl.
115 */ 111 */
116 function SYNC_TEST_F(testFixture, testName, testFunction) { 112 function SYNC_TEST_F(testFixture, testName, testFunction) {
117 var wrappedTestFunction = function() { 113 var wrappedTestFunction = function() {
118 testFunction.call(this); 114 testFunction.call(this);
119 testDone([true, '']); 115 testDone([true, '']);
120 }; 116 };
121 TEST_F(testFixture, testName, wrappedTestFunction); 117 TEST_F(testFixture, testName, wrappedTestFunction);
122 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698