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

Unified Diff: chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js

Issue 938623003: Fix ChromeVox next tests to fail instead of timing out where applicable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify async callback handling in the tests. Created 5 years, 9 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/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js b/chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js
index 5eebf0b0085f268dd24e6e3ad05d4f6ac94142c6..4493cec5082526756e84378aa89d2baf87c88475 100644
--- a/chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js
+++ b/chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js
@@ -14,38 +14,32 @@ GEN_INCLUDE(['chrome/browser/resources/chromeos/chromevox/testing/' +
* @constructor
* @extends {ChromeVoxE2ETest}
*/
-function ChromeVoxNextE2ETest() {}
+function ChromeVoxNextE2ETest() {
+ ChromeVoxE2ETest.call(this);
+}
ChromeVoxNextE2ETest.prototype = {
__proto__: ChromeVoxE2ETest.prototype,
/**
- * This method is called without |this| bound to an instance of
- * ChromeVoxNextE2ETest.
- * @override
- */
- testGenCppIncludes: function() {
- ChromeVoxE2ETest.prototype.testGenCppIncludes.call(this);
- GEN('#include "base/command_line.h"');
- },
-
- /**
* Launches a new tab with the given document, and runs callback when a load
* complete fires.
* @param {function() : void} doc Snippet wrapped inside of a function.
* @param {function()} opt_callback Called once the document is ready.
*/
runWithLoadedTree: function(doc, callback) {
+ callback = this.newCallback(callback);
chrome.automation.getDesktop(function(r) {
- function callbackInternal(evt) {
+ var listener = function(evt) {
if (!evt.target.attributes.url ||
evt.target.attributes.url.indexOf('test') == -1)
return;
- r.removeEventListener(callbackInternal);
- callback(evt.target);
- }
- r.addEventListener('loadComplete', callbackInternal, true);
+ r.removeEventListener(listener);
+ callback && callback(evt.target);
+ callback = null;
+ };
+ r.addEventListener('loadComplete', listener, true);
this.runWithTab(doc);
}.bind(this));
}

Powered by Google App Engine
This is Rietveld 408576698