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 /** | 5 /** |
6 * Test fixture for background.js. | 6 * Test fixture for background.js. |
7 * @constructor | 7 * @constructor |
8 * @extends {testing.Test} | 8 * @extends {testing.Test} |
9 */ | 9 */ |
10 function GoogleNowBackgroundUnitTest () { | 10 function GoogleNowBackgroundUnitTest () { |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 will(invokeCallback( | 388 will(invokeCallback( |
389 googleGeolocationPrefGetSavedArgs, 1, {value: testGeolocationPref})); | 389 googleGeolocationPrefGetSavedArgs, 1, {value: testGeolocationPref})); |
390 | 390 |
391 var storageGetSavedArgs = new SaveMockArguments(); | 391 var storageGetSavedArgs = new SaveMockArguments(); |
392 fixture.mockApis.expects(once()). | 392 fixture.mockApis.expects(once()). |
393 instrumented_storage_local_get( | 393 instrumented_storage_local_get( |
394 storageGetSavedArgs.match(eq('userRespondedToToast')), | 394 storageGetSavedArgs.match(eq('userRespondedToToast')), |
395 storageGetSavedArgs.match(ANYTHING)). | 395 storageGetSavedArgs.match(ANYTHING)). |
396 will(invokeCallback(storageGetSavedArgs, 1, testUserRespondedToToast)); | 396 will(invokeCallback(storageGetSavedArgs, 1, testUserRespondedToToast)); |
397 | 397 |
398 var setBackgroundEnableSavedArgs = new SaveMockArguments(); | |
399 fixture.mockGlobals.expects(once()). | 398 fixture.mockGlobals.expects(once()). |
400 setBackgroundEnable( | 399 setBackgroundEnable(ANYTHING); |
401 setBackgroundEnableSavedArgs.match(ANYTHING), | |
402 setBackgroundEnableSavedArgs.match(ANYTHING)). | |
403 will(invokeCallback( | |
404 setBackgroundEnableSavedArgs, 1, {})); | |
405 } | 400 } |
406 | 401 |
407 /** | 402 /** |
408 * Sets up the test to expect the initialization calls that | 403 * Sets up the test to expect the initialization calls that |
409 * initialize() invokes. | 404 * initialize() invokes. |
410 * Note that this CAN NOT be used if any of the methods below are called | 405 * Note that this CAN NOT be used if any of the methods below are called |
411 * outside of this context with the same argument matchers. | 406 * outside of this context with the same argument matchers. |
412 * expects() calls cannot be chained with the same argument matchers. | 407 * expects() calls cannot be chained with the same argument matchers. |
413 */ | 408 */ |
414 function expectInitialization(mockApisObj) { | 409 function expectInitialization(mockApisObj) { |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), | 789 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), |
795 chromeTabsCreateSavedArgs.match(ANYTHING)). | 790 chromeTabsCreateSavedArgs.match(ANYTHING)). |
796 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); | 791 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); |
797 this.mockApis.expects(once()).chrome_windows_create( | 792 this.mockApis.expects(once()).chrome_windows_create( |
798 eqJSON({url: testActionUrl, focused: true})); | 793 eqJSON({url: testActionUrl, focused: true})); |
799 | 794 |
800 // Invoking the tested function. | 795 // Invoking the tested function. |
801 onNotificationClicked( | 796 onNotificationClicked( |
802 testNotificationId, this.mockLocalFunctions.functions().selector); | 797 testNotificationId, this.mockLocalFunctions.functions().selector); |
803 }); | 798 }); |
OLD | NEW |