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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 function mockInitializeDependencies(fixture) { | 58 function mockInitializeDependencies(fixture) { |
59 fixture.makeAndRegisterMockGlobals([ | 59 fixture.makeAndRegisterMockGlobals([ |
60 'recordEvent', | 60 'recordEvent', |
61 'setBackgroundEnable', | 61 'setBackgroundEnable', |
62 'startPollingCards' | 62 'startPollingCards' |
63 ]); | 63 ]); |
64 fixture.makeAndRegisterMockApis([ | 64 fixture.makeAndRegisterMockApis([ |
65 'authenticationManager.isSignedIn', | 65 'authenticationManager.isSignedIn', |
66 'chrome.location.clearWatch', | 66 'chrome.location.clearWatch', |
67 'chrome.storage.local.remove', | 67 'chrome.storage.local.remove', |
| 68 'fillFromChromeLocalStorage', |
68 'instrumented.metricsPrivate.getVariationParams', | 69 'instrumented.metricsPrivate.getVariationParams', |
69 'instrumented.notifications.getAll', | 70 'instrumented.notifications.getAll', |
70 'instrumented.notifications.getPermissionLevel', | 71 'instrumented.notifications.getPermissionLevel', |
71 'instrumented.preferencesPrivate.googleGeolocationAccessEnabled.get', | 72 'instrumented.preferencesPrivate.googleGeolocationAccessEnabled.get', |
72 'instrumented.storage.local.get', | |
73 'instrumented.webstorePrivate.getBrowserLogin', | 73 'instrumented.webstorePrivate.getBrowserLogin', |
74 'tasks.add', | 74 'tasks.add', |
75 'updateCardsAttempts.isRunning', | 75 'updateCardsAttempts.isRunning', |
76 'updateCardsAttempts.stop' | 76 'updateCardsAttempts.stop' |
77 ]); | 77 ]); |
78 } | 78 } |
79 | 79 |
80 /** | 80 /** |
81 * Sets up the test to expect the state machine calls and send | 81 * Sets up the test to expect the state machine calls and send |
82 * the specified state machine state. Currently used to test initialize(). | 82 * the specified state machine state. Currently used to test initialize(). |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 var notificationGetPermissionLevelSavedArgs = new SaveMockArguments(); | 125 var notificationGetPermissionLevelSavedArgs = new SaveMockArguments(); |
126 fixture.mockApis.expects(once()). | 126 fixture.mockApis.expects(once()). |
127 instrumented_notifications_getPermissionLevel( | 127 instrumented_notifications_getPermissionLevel( |
128 notificationGetPermissionLevelSavedArgs.match(ANYTHING)). | 128 notificationGetPermissionLevelSavedArgs.match(ANYTHING)). |
129 will(invokeCallback( | 129 will(invokeCallback( |
130 notificationGetPermissionLevelSavedArgs, | 130 notificationGetPermissionLevelSavedArgs, |
131 0, | 131 0, |
132 testNotificationPermissionLevel)) | 132 testNotificationPermissionLevel)) |
133 | 133 |
134 var storageGetSavedArgs = new SaveMockArguments(); | 134 expectChromeLocalStorageGet( |
135 fixture.mockApis.expects(once()). | 135 fixture, |
136 instrumented_storage_local_get( | 136 {googleNowEnabled: false}, |
137 storageGetSavedArgs.match(eq('googleNowEnabled')), | 137 {googleNowEnabled: testGoogleNowEnabled}); |
138 storageGetSavedArgs.match(ANYTHING)). | |
139 will(invokeCallback( | |
140 storageGetSavedArgs, 1, {googleNowEnabled: testGoogleNowEnabled})); | |
141 | 138 |
142 fixture.mockGlobals.expects(once()). | 139 fixture.mockGlobals.expects(once()). |
143 setBackgroundEnable(ANYTHING); | 140 setBackgroundEnable(ANYTHING); |
144 } | 141 } |
145 | 142 |
146 /** | 143 /** |
147 * Sets up the test to expect the initialization calls that | 144 * Sets up the test to expect the initialization calls that |
148 * initialize() invokes. | 145 * initialize() invokes. |
149 * Note that this CAN NOT be used if any of the methods below are called | 146 * Note that this CAN NOT be used if any of the methods below are called |
150 * outside of this context with the same argument matchers. | 147 * outside of this context with the same argument matchers. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 }); | 321 }); |
325 | 322 |
326 /** | 323 /** |
327 * Mocks global functions and APIs that onNotificationClicked() depends upon. | 324 * Mocks global functions and APIs that onNotificationClicked() depends upon. |
328 * @param {Test} fixture Test fixture. | 325 * @param {Test} fixture Test fixture. |
329 */ | 326 */ |
330 function mockOnNotificationClickedDependencies(fixture) { | 327 function mockOnNotificationClickedDependencies(fixture) { |
331 fixture.makeAndRegisterMockApis([ | 328 fixture.makeAndRegisterMockApis([ |
332 'chrome.windows.create', | 329 'chrome.windows.create', |
333 'chrome.windows.update', | 330 'chrome.windows.update', |
334 'instrumented.storage.local.get', | 331 'fillFromChromeLocalStorage', |
335 'instrumented.tabs.create']); | 332 'instrumented.tabs.create']); |
336 } | 333 } |
337 | 334 |
338 TEST_F( | 335 TEST_F( |
339 'GoogleNowBackgroundUnitTest', | 336 'GoogleNowBackgroundUnitTest', |
340 'OnNotificationClicked_NoData', | 337 'OnNotificationClicked_NoData', |
341 function() { | 338 function() { |
342 // Tests the case when there is no data associated with notification id. | 339 // Tests the case when there is no data associated with notification id. |
343 // In this case, the function should do nothing. | 340 // In this case, the function should do nothing. |
344 | 341 |
345 // Setup and expectations. | 342 // Setup and expectations. |
346 var testNotificationId = 'TEST_ID'; | 343 var testNotificationId = 'TEST_ID'; |
347 var testNotificationData = {}; | 344 var testNotificationDataRequest = {notificationsData: {}}; |
| 345 var testNotificationData = {notificationsData: {}}; |
348 | 346 |
349 mockOnNotificationClickedDependencies(this); | 347 mockOnNotificationClickedDependencies(this); |
350 this.makeMockLocalFunctions(['selector']); | 348 this.makeMockLocalFunctions(['selector']); |
351 | 349 |
352 var storageGetSavedArgs = new SaveMockArguments(); | 350 expectChromeLocalStorageGet( |
353 this.mockApis.expects(once()). | 351 this, testNotificationDataRequest, testNotificationData); |
354 instrumented_storage_local_get( | |
355 storageGetSavedArgs.match(eq('notificationsData')), | |
356 storageGetSavedArgs.match(ANYTHING)). | |
357 will(invokeCallback(storageGetSavedArgs, 1, testNotificationData)); | |
358 | 352 |
359 // Invoking the tested function. | 353 // Invoking the tested function. |
360 onNotificationClicked( | 354 onNotificationClicked( |
361 testNotificationId, this.mockLocalFunctions.functions().selector); | 355 testNotificationId, this.mockLocalFunctions.functions().selector); |
362 }); | 356 }); |
363 | 357 |
364 TEST_F( | 358 TEST_F( |
365 'GoogleNowBackgroundUnitTest', | 359 'GoogleNowBackgroundUnitTest', |
366 'OnNotificationClicked_ActionUrlsUndefined', | 360 'OnNotificationClicked_ActionUrlsUndefined', |
367 function() { | 361 function() { |
368 // Tests the case when the data associated with notification id is | 362 // Tests the case when the data associated with notification id is |
369 // 'undefined'. | 363 // 'undefined'. |
370 // In this case, the function should do nothing. | 364 // In this case, the function should do nothing. |
371 | 365 |
372 // Setup and expectations. | 366 // Setup and expectations. |
373 var testActionUrls = undefined; | 367 var testActionUrls = undefined; |
374 var testNotificationId = 'TEST_ID'; | 368 var testNotificationId = 'TEST_ID'; |
| 369 var testNotificationDataRequest = {notificationsData: {}}; |
375 var testNotificationData = { | 370 var testNotificationData = { |
376 notificationsData: {'TEST_ID': {actionUrls: testActionUrls}} | 371 notificationsData: {'TEST_ID': {actionUrls: testActionUrls}} |
377 }; | 372 }; |
378 | 373 |
379 mockOnNotificationClickedDependencies(this); | 374 mockOnNotificationClickedDependencies(this); |
380 this.makeMockLocalFunctions(['selector']); | 375 this.makeMockLocalFunctions(['selector']); |
381 | 376 |
382 var storageGetSavedArgs = new SaveMockArguments(); | 377 expectChromeLocalStorageGet( |
383 this.mockApis.expects(once()). | 378 this, testNotificationDataRequest, testNotificationData); |
384 instrumented_storage_local_get( | 379 |
385 storageGetSavedArgs.match(eq('notificationsData')), | |
386 storageGetSavedArgs.match(ANYTHING)). | |
387 will(invokeCallback(storageGetSavedArgs, 1, testNotificationData)); | |
388 this.mockLocalFunctions.expects(once()).selector(undefined).will( | 380 this.mockLocalFunctions.expects(once()).selector(undefined).will( |
389 returnValue(undefined)); | 381 returnValue(undefined)); |
390 | 382 |
391 // Invoking the tested function. | 383 // Invoking the tested function. |
392 onNotificationClicked( | 384 onNotificationClicked( |
393 testNotificationId, this.mockLocalFunctions.functions().selector); | 385 testNotificationId, this.mockLocalFunctions.functions().selector); |
394 }); | 386 }); |
395 | 387 |
396 TEST_F( | 388 TEST_F( |
397 'GoogleNowBackgroundUnitTest', | 389 'GoogleNowBackgroundUnitTest', |
398 'OnNotificationClicked_TabCreateSuccess', | 390 'OnNotificationClicked_TabCreateSuccess', |
399 function() { | 391 function() { |
400 // Tests the selected URL is OK and crome.tabs.create suceeds. | 392 // Tests the selected URL is OK and crome.tabs.create suceeds. |
401 | 393 |
402 // Setup and expectations. | 394 // Setup and expectations. |
403 var testActionUrls = {testField: 'TEST VALUE'}; | 395 var testActionUrls = {testField: 'TEST VALUE'}; |
404 var testNotificationId = 'TEST_ID'; | 396 var testNotificationId = 'TEST_ID'; |
| 397 var testNotificationDataRequest = {notificationsData: {}}; |
405 var testNotificationData = { | 398 var testNotificationData = { |
406 notificationsData: {'TEST_ID': {actionUrls: testActionUrls}} | 399 notificationsData: {'TEST_ID': {actionUrls: testActionUrls}} |
407 }; | 400 }; |
408 var testActionUrl = 'http://testurl.com'; | 401 var testActionUrl = 'http://testurl.com'; |
409 var testCreatedTab = {windowId: 239}; | 402 var testCreatedTab = {windowId: 239}; |
410 | 403 |
411 mockOnNotificationClickedDependencies(this); | 404 mockOnNotificationClickedDependencies(this); |
412 this.makeMockLocalFunctions(['selector']); | 405 this.makeMockLocalFunctions(['selector']); |
413 | 406 |
414 var storageGetSavedArgs = new SaveMockArguments(); | 407 expectChromeLocalStorageGet( |
415 this.mockApis.expects(once()). | 408 this, testNotificationDataRequest, testNotificationData); |
416 instrumented_storage_local_get( | |
417 storageGetSavedArgs.match(eq('notificationsData')), | |
418 storageGetSavedArgs.match(ANYTHING)). | |
419 will(invokeCallback(storageGetSavedArgs, 1, testNotificationData)); | |
420 this.mockLocalFunctions.expects(once()).selector(testActionUrls).will( | 409 this.mockLocalFunctions.expects(once()).selector(testActionUrls).will( |
421 returnValue(testActionUrl)); | 410 returnValue(testActionUrl)); |
422 var chromeTabsCreateSavedArgs = new SaveMockArguments(); | 411 var chromeTabsCreateSavedArgs = new SaveMockArguments(); |
423 this.mockApis.expects(once()). | 412 this.mockApis.expects(once()). |
424 instrumented_tabs_create( | 413 instrumented_tabs_create( |
425 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), | 414 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), |
426 chromeTabsCreateSavedArgs.match(ANYTHING)). | 415 chromeTabsCreateSavedArgs.match(ANYTHING)). |
427 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); | 416 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); |
428 this.mockApis.expects(once()).chrome_windows_update( | 417 this.mockApis.expects(once()).chrome_windows_update( |
429 testCreatedTab.windowId, | 418 testCreatedTab.windowId, |
430 eqJSON({focused: true})); | 419 eqJSON({focused: true})); |
431 | 420 |
432 // Invoking the tested function. | 421 // Invoking the tested function. |
433 onNotificationClicked( | 422 onNotificationClicked( |
434 testNotificationId, this.mockLocalFunctions.functions().selector); | 423 testNotificationId, this.mockLocalFunctions.functions().selector); |
435 }); | 424 }); |
436 | 425 |
437 TEST_F( | 426 TEST_F( |
438 'GoogleNowBackgroundUnitTest', | 427 'GoogleNowBackgroundUnitTest', |
439 'OnNotificationClicked_TabCreateFail', | 428 'OnNotificationClicked_TabCreateFail', |
440 function() { | 429 function() { |
441 // Tests the selected URL is OK and crome.tabs.create fails. | 430 // Tests the selected URL is OK and crome.tabs.create fails. |
442 // In this case, the function should invoke chrome.windows.create as a | 431 // In this case, the function should invoke chrome.windows.create as a |
443 // second attempt. | 432 // second attempt. |
444 | 433 |
445 // Setup and expectations. | 434 // Setup and expectations. |
446 var testActionUrls = {testField: 'TEST VALUE'}; | 435 var testActionUrls = {testField: 'TEST VALUE'}; |
447 var testNotificationId = 'TEST_ID'; | 436 var testNotificationId = 'TEST_ID'; |
| 437 var testNotificationDataRequest = {notificationsData: {}}; |
448 var testNotificationData = { | 438 var testNotificationData = { |
449 notificationsData: {'TEST_ID': {actionUrls: testActionUrls}} | 439 notificationsData: {'TEST_ID': {actionUrls: testActionUrls}} |
450 }; | 440 }; |
451 var testActionUrl = 'http://testurl.com'; | 441 var testActionUrl = 'http://testurl.com'; |
452 var testCreatedTab = undefined; // chrome.tabs.create fails | 442 var testCreatedTab = undefined; // chrome.tabs.create fails |
453 | 443 |
454 mockOnNotificationClickedDependencies(this); | 444 mockOnNotificationClickedDependencies(this); |
455 this.makeMockLocalFunctions(['selector']); | 445 this.makeMockLocalFunctions(['selector']); |
456 | 446 |
457 var storageGetSavedArgs = new SaveMockArguments(); | 447 expectChromeLocalStorageGet( |
458 this.mockApis.expects(once()). | 448 this, testNotificationDataRequest, testNotificationData); |
459 instrumented_storage_local_get( | |
460 storageGetSavedArgs.match(eq('notificationsData')), | |
461 storageGetSavedArgs.match(ANYTHING)). | |
462 will(invokeCallback(storageGetSavedArgs, 1, testNotificationData)); | |
463 this.mockLocalFunctions.expects(once()).selector(testActionUrls).will( | 449 this.mockLocalFunctions.expects(once()).selector(testActionUrls).will( |
464 returnValue(testActionUrl)); | 450 returnValue(testActionUrl)); |
465 var chromeTabsCreateSavedArgs = new SaveMockArguments(); | 451 var chromeTabsCreateSavedArgs = new SaveMockArguments(); |
466 this.mockApis.expects(once()). | 452 this.mockApis.expects(once()). |
467 instrumented_tabs_create( | 453 instrumented_tabs_create( |
468 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), | 454 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), |
469 chromeTabsCreateSavedArgs.match(ANYTHING)). | 455 chromeTabsCreateSavedArgs.match(ANYTHING)). |
470 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); | 456 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); |
471 this.mockApis.expects(once()).chrome_windows_create( | 457 this.mockApis.expects(once()).chrome_windows_create( |
472 eqJSON({url: testActionUrl, focused: true})); | 458 eqJSON({url: testActionUrl, focused: true})); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 } | 736 } |
751 }; | 737 }; |
752 | 738 |
753 var expectedUpdatedRecentDismissals = { | 739 var expectedUpdatedRecentDismissals = { |
754 c5: 1800001 | 740 c5: 1800001 |
755 }; | 741 }; |
756 | 742 |
757 var fakeOnCardShownFunction = 'FAKE ON CARD SHOWN FUNCTION'; | 743 var fakeOnCardShownFunction = 'FAKE ON CARD SHOWN FUNCTION'; |
758 | 744 |
759 this.makeAndRegisterMockGlobals([ | 745 this.makeAndRegisterMockGlobals([ |
760 'scheduleNextPoll', | |
761 'combineAndShowNotificationCards', | 746 'combineAndShowNotificationCards', |
762 'recordEvent' | 747 'recordEvent', |
| 748 'scheduleNextPoll' |
763 ]); | 749 ]); |
764 | 750 |
765 this.makeAndRegisterMockApis([ | 751 this.makeAndRegisterMockApis([ |
766 'chrome.storage.local.set', | 752 'chrome.storage.local.set', |
767 'instrumented.storage.local.get' | 753 'fillFromChromeLocalStorage' |
768 ]); | 754 ]); |
769 | 755 |
770 var storageGetSavedArgs = new SaveMockArguments(); | 756 expectChromeLocalStorageGet( |
771 this.mockApis.expects(once()). | 757 this, |
772 instrumented_storage_local_get( | 758 { |
773 storageGetSavedArgs.match( | 759 notificationGroups: {}, |
774 eq(['notificationGroups', 'recentDismissals'])), | 760 recentDismissals: {} |
775 storageGetSavedArgs.match(ANYTHING)). | 761 }, |
776 will(invokeCallback( | 762 { |
777 storageGetSavedArgs, | 763 notificationGroups: storedGroups, |
778 1, | 764 recentDismissals: recentDismissals |
779 { | 765 }); |
780 notificationGroups: storedGroups, | |
781 recentDismissals: recentDismissals | |
782 })); | |
783 | 766 |
784 this.mockGlobals.expects(once()). | 767 this.mockGlobals.expects(once()). |
785 scheduleNextPoll(eqJSON(expectedUpdatedGroups), true); | 768 scheduleNextPoll(eqJSON(expectedUpdatedGroups), true); |
786 | 769 |
787 var combineAndShowNotificationCardsSavedArgs = new SaveMockArguments(); | 770 var combineAndShowNotificationCardsSavedArgs = new SaveMockArguments(); |
788 this.mockGlobals.expects(once()). | 771 this.mockGlobals.expects(once()). |
789 combineAndShowNotificationCards( | 772 combineAndShowNotificationCards( |
790 combineAndShowNotificationCardsSavedArgs.match( | 773 combineAndShowNotificationCardsSavedArgs.match( |
791 eqJSON(expectedUpdatedGroups)), | 774 eqJSON(expectedUpdatedGroups)), |
792 combineAndShowNotificationCardsSavedArgs.match( | 775 combineAndShowNotificationCardsSavedArgs.match( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 nextPollTime: 10001 | 818 nextPollTime: 10001 |
836 } | 819 } |
837 }; | 820 }; |
838 | 821 |
839 var expectedUpdatedGroups = { | 822 var expectedUpdatedGroups = { |
840 }; | 823 }; |
841 | 824 |
842 var fakeOnCardShownFunction = 'FAKE ON CARD SHOWN FUNCTION'; | 825 var fakeOnCardShownFunction = 'FAKE ON CARD SHOWN FUNCTION'; |
843 | 826 |
844 this.makeAndRegisterMockGlobals([ | 827 this.makeAndRegisterMockGlobals([ |
845 'scheduleNextPoll', | |
846 'combineAndShowNotificationCards', | 828 'combineAndShowNotificationCards', |
| 829 'onStateChange', |
847 'recordEvent', | 830 'recordEvent', |
848 'onStateChange' | 831 'scheduleNextPoll' |
849 ]); | 832 ]); |
850 | 833 |
851 this.makeAndRegisterMockApis([ | 834 this.makeAndRegisterMockApis([ |
852 'chrome.storage.local.set', | 835 'chrome.storage.local.set', |
853 'instrumented.storage.local.get' | 836 'fillFromChromeLocalStorage' |
854 ]); | 837 ]); |
855 | 838 |
856 this.mockApis.expects(once()). | 839 this.mockApis.expects(once()). |
857 chrome_storage_local_set( | 840 chrome_storage_local_set( |
858 eqJSON({googleNowEnabled: false})); | 841 eqJSON({googleNowEnabled: false})); |
859 | 842 |
860 this.mockGlobals.expects(once()).onStateChange(); | 843 this.mockGlobals.expects(once()).onStateChange(); |
861 | 844 |
862 var storageGetSavedArgs = new SaveMockArguments(); | 845 expectChromeLocalStorageGet( |
863 this.mockApis.expects(once()). | 846 this, |
864 instrumented_storage_local_get( | 847 { |
865 storageGetSavedArgs.match( | 848 notificationGroups: {}, |
866 eq(['notificationGroups', 'recentDismissals'])), | 849 recentDismissals: {} |
867 storageGetSavedArgs.match(ANYTHING)). | 850 }, |
868 will(invokeCallback( | 851 { |
869 storageGetSavedArgs, 1, {notificationGroups: storedGroups})); | 852 notificationGroups: storedGroups, |
| 853 recentDismissals: {} |
| 854 }); |
870 | 855 |
871 this.mockGlobals.expects(once()). | 856 this.mockGlobals.expects(once()). |
872 scheduleNextPoll(eqJSON(expectedUpdatedGroups), false); | 857 scheduleNextPoll(eqJSON(expectedUpdatedGroups), false); |
873 | 858 |
874 var combineAndShowNotificationCardsSavedArgs = new SaveMockArguments(); | 859 var combineAndShowNotificationCardsSavedArgs = new SaveMockArguments(); |
875 this.mockGlobals.expects(once()). | 860 this.mockGlobals.expects(once()). |
876 combineAndShowNotificationCards( | 861 combineAndShowNotificationCards( |
877 combineAndShowNotificationCardsSavedArgs.match( | 862 combineAndShowNotificationCardsSavedArgs.match( |
878 eqJSON(expectedUpdatedGroups)), | 863 eqJSON(expectedUpdatedGroups)), |
879 combineAndShowNotificationCardsSavedArgs.match( | 864 combineAndShowNotificationCardsSavedArgs.match( |
880 ANYTHING), | 865 ANYTHING), |
881 combineAndShowNotificationCardsSavedArgs.match( | 866 combineAndShowNotificationCardsSavedArgs.match( |
882 eq(fakeOnCardShownFunction))). | 867 eq(fakeOnCardShownFunction))). |
883 will(invokeCallback(combineAndShowNotificationCardsSavedArgs, 1)); | 868 will(invokeCallback(combineAndShowNotificationCardsSavedArgs, 1)); |
884 | 869 |
885 this.mockApis.expects(once()). | 870 this.mockApis.expects(once()). |
886 chrome_storage_local_set( | 871 chrome_storage_local_set( |
887 eqJSON({ | 872 eqJSON({ |
888 notificationGroups: expectedUpdatedGroups, | 873 notificationGroups: expectedUpdatedGroups, |
889 recentDismissals: {}})); | 874 recentDismissals: {}})); |
890 | 875 |
891 this.mockGlobals.expects(once()). | 876 this.mockGlobals.expects(once()). |
892 recordEvent(GoogleNowEvent.CARDS_PARSE_SUCCESS); | 877 recordEvent(GoogleNowEvent.CARDS_PARSE_SUCCESS); |
893 | 878 |
894 // Invoking the tested function. | 879 // Invoking the tested function. |
895 processServerResponse(serverResponse, fakeOnCardShownFunction); | 880 processServerResponse(serverResponse, fakeOnCardShownFunction); |
896 }); | 881 }); |
OLD | NEW |