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

Unified Diff: trunk/src/chrome/browser/resources/google_now/common_test_util.js

Issue 171713007: Revert of Convert Google Now's Authentication Manager to use Promises (https://codereview.chromium.… (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/resources/google_now/common_test_util.js
===================================================================
--- trunk/src/chrome/browser/resources/google_now/common_test_util.js (revision 252133)
+++ trunk/src/chrome/browser/resources/google_now/common_test_util.js (working copy)
@@ -82,35 +82,16 @@
var Promise = function() {
function PromisePrototypeObject(asyncTask) {
var result;
- var resolved = false;
asyncTask(
function(asyncResult) {
result = asyncResult;
- resolved = true;
},
- function(asyncFailureResult) {
- result = asyncFailureResult;
- resolved = false;
- });
+ function() {}); // Errors are unsupported.
function then(callback) {
- if (resolved) {
- callback.call(null, result);
- }
- return this;
+ callback.call(null, result);
}
-
- // Promises use the function name "catch" to call back error handlers.
- // We can't use "catch" since function or variable names cannot use the word
- // "catch".
- function catchFunc(callback) {
- if (!resolved) {
- callback.call(null, result);
- }
- return this;
- }
-
- return {then: then, catch: catchFunc, isPromise: true};
+ return {then: then, isPromise: true};
}
function all(arrayOfPromises) {

Powered by Google App Engine
This is Rietveld 408576698