| Index: chrome/browser/resources/google_now/common_test_util.js
|
| diff --git a/chrome/browser/resources/google_now/common_test_util.js b/chrome/browser/resources/google_now/common_test_util.js
|
| index 44d21e6d1f640ea07406a7919738959bcbb09706..66d65f49d9efa9d3f0f77aa6db76165f119cf9c1 100644
|
| --- a/chrome/browser/resources/google_now/common_test_util.js
|
| +++ b/chrome/browser/resources/google_now/common_test_util.js
|
| @@ -129,6 +129,36 @@ var Promise = function() {
|
| });
|
| return promise;
|
| }
|
| +
|
| + function resolve(value) {
|
| + var promise = new PromisePrototypeObject(function(resolve) {
|
| + resolve(value);
|
| + });
|
| + return promise;
|
| + }
|
| +
|
| PromisePrototypeObject.all = all;
|
| + PromisePrototypeObject.resolve = resolve;
|
| return PromisePrototypeObject;
|
| }();
|
| +
|
| +
|
| +/**
|
| + * Sets up the test to expect a Chrome Local Storage call.
|
| + * @param {Object} fixture Mock JS Test Object.
|
| + * @param {Object} defaultObject Storage request default object.
|
| + * @param {Object} result Storage result.
|
| + * @param {boolean=} opt_AllowRejection Allow Promise Rejection
|
| + */
|
| +function expectChromeLocalStorageGet(
|
| + fixture, defaultObject, result, opt_AllowRejection) {
|
| + if (opt_AllowRejection === undefined) {
|
| + fixture.mockApis.expects(once()).
|
| + fillFromChromeLocalStorage(eqJSON(defaultObject)).
|
| + will(returnValue(Promise.resolve(result)));
|
| + } else {
|
| + fixture.mockApis.expects(once()).
|
| + fillFromChromeLocalStorage(eqJSON(defaultObject), opt_AllowRejection).
|
| + will(returnValue(Promise.resolve(result)));
|
| + }
|
| +}
|
|
|