OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // TODO(robliao,vadimt): Determine the granularity of testing to perform. | 5 // TODO(robliao,vadimt): Determine the granularity of testing to perform. |
6 | 6 |
7 /** | 7 /** |
8 * Test fixture for background.js. | 8 * Test fixture for background.js. |
9 * @constructor | 9 * @constructor |
10 * @extends {testing.Test} | 10 * @extends {testing.Test} |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 tasksAddSavedArgs.match(ANYTHING)). | 706 tasksAddSavedArgs.match(ANYTHING)). |
707 will(invokeCallback(tasksAddSavedArgs, 1, function() {})); | 707 will(invokeCallback(tasksAddSavedArgs, 1, function() {})); |
708 | 708 |
709 // The ordering here between stubs and expects is important. | 709 // The ordering here between stubs and expects is important. |
710 // We only care about the EXTENSION_START event. The other events are covered | 710 // We only care about the EXTENSION_START event. The other events are covered |
711 // by the NoCards tests below. Reversing the calls will cause all recordEvent | 711 // by the NoCards tests below. Reversing the calls will cause all recordEvent |
712 // calls to be unexpected. | 712 // calls to be unexpected. |
713 fixture.mockGlobals.stubs().recordEvent(ANYTHING); | 713 fixture.mockGlobals.stubs().recordEvent(ANYTHING); |
714 fixture.mockGlobals. | 714 fixture.mockGlobals. |
715 expects(once()).recordEvent(GoogleNowEvent.EXTENSION_START); | 715 expects(once()).recordEvent(GoogleNowEvent.EXTENSION_START); |
| 716 fixture.mockApis.expects(once()) |
| 717 .fillFromChromeLocalStorage(eqJSON({gcmNotificationKey: undefined})) |
| 718 .will(returnValue(Promise.resolve({gcmNotificationKey: 'gcmkey'}))); |
| 719 |
716 } | 720 } |
717 | 721 |
718 TEST_F(TEST_NAME,'Initialize_SignedOut', function() { | 722 TEST_F(TEST_NAME,'Initialize_SignedOut', function() { |
719 // Tests the case when getAuthToken fails most likely because the user is | 723 // Tests the case when getAuthToken fails most likely because the user is |
720 // not signed in. In this case, the function should quietly exit after | 724 // not signed in. In this case, the function should quietly exit after |
721 // finding out that getAuthToken fails. | 725 // finding out that getAuthToken fails. |
722 | 726 |
723 // Setup and expectations. | 727 // Setup and expectations. |
724 var testIdentityToken = undefined; | 728 var testIdentityToken = undefined; |
725 var testExperimentVariationParams = {}; | 729 var testExperimentVariationParams = {}; |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 | 1345 |
1342 this.mockApis.expects(once()). | 1346 this.mockApis.expects(once()). |
1343 chrome_storage_local_set(eqJSON({googleNowEnabled: false})); | 1347 chrome_storage_local_set(eqJSON({googleNowEnabled: false})); |
1344 | 1348 |
1345 this.mockGlobals.expects(never()).scheduleNextCardsPoll(); | 1349 this.mockGlobals.expects(never()).scheduleNextCardsPoll(); |
1346 | 1350 |
1347 // Invoking the tested function. | 1351 // Invoking the tested function. |
1348 processServerResponse(serverResponse); | 1352 processServerResponse(serverResponse); |
1349 }); | 1353 }); |
1350 | 1354 |
OLD | NEW |