| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // Setup and expectations. | 153 // Setup and expectations. |
| 154 NOTIFICATION_CARDS_URL = undefined; | 154 NOTIFICATION_CARDS_URL = undefined; |
| 155 var testIdentityToken = undefined; | 155 var testIdentityToken = undefined; |
| 156 var testGeolocationPref = false; | 156 var testGeolocationPref = false; |
| 157 var testUserRespondedToToast = {}; | 157 var testUserRespondedToToast = {}; |
| 158 | 158 |
| 159 mockInitializeDependencies(this); | 159 mockInitializeDependencies(this); |
| 160 | 160 |
| 161 this.mockGlobals.expects(once()).recordEvent( | 161 this.mockGlobals.expects(once()).recordEvent( |
| 162 DiagnosticEvent.EXTENSION_START); | 162 GoogleNowEvent.EXTENSION_START); |
| 163 | 163 |
| 164 expectInitialization(this.mockApis); | 164 expectInitialization(this.mockApis); |
| 165 | 165 |
| 166 expectStateMachineCalls( | 166 expectStateMachineCalls( |
| 167 this.mockApis, | 167 this.mockApis, |
| 168 testIdentityToken, | 168 testIdentityToken, |
| 169 testGeolocationPref, | 169 testGeolocationPref, |
| 170 testUserRespondedToToast); | 170 testUserRespondedToToast); |
| 171 | 171 |
| 172 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); | 172 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 193 | 193 |
| 194 // Setup and expectations. | 194 // Setup and expectations. |
| 195 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; | 195 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; |
| 196 var testIdentityToken = undefined; | 196 var testIdentityToken = undefined; |
| 197 var testGeolocationPref = false; | 197 var testGeolocationPref = false; |
| 198 var testUserRespondedToToast = {}; | 198 var testUserRespondedToToast = {}; |
| 199 | 199 |
| 200 mockInitializeDependencies(this); | 200 mockInitializeDependencies(this); |
| 201 | 201 |
| 202 this.mockGlobals.expects(once()).recordEvent( | 202 this.mockGlobals.expects(once()).recordEvent( |
| 203 DiagnosticEvent.EXTENSION_START); | 203 GoogleNowEvent.EXTENSION_START); |
| 204 | 204 |
| 205 expectInitialization(this.mockApis); | 205 expectInitialization(this.mockApis); |
| 206 | 206 |
| 207 expectStateMachineCalls( | 207 expectStateMachineCalls( |
| 208 this.mockApis, | 208 this.mockApis, |
| 209 testIdentityToken, | 209 testIdentityToken, |
| 210 testGeolocationPref, | 210 testGeolocationPref, |
| 211 testUserRespondedToToast); | 211 testUserRespondedToToast); |
| 212 | 212 |
| 213 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); | 213 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 232 | 232 |
| 233 // Setup and expectations. | 233 // Setup and expectations. |
| 234 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; | 234 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; |
| 235 var testIdentityToken = 'some identity token'; | 235 var testIdentityToken = 'some identity token'; |
| 236 var testGeolocationPref = false; | 236 var testGeolocationPref = false; |
| 237 var testUserRespondedToToast = {}; | 237 var testUserRespondedToToast = {}; |
| 238 | 238 |
| 239 mockInitializeDependencies(this); | 239 mockInitializeDependencies(this); |
| 240 | 240 |
| 241 this.mockGlobals.expects(once()).recordEvent( | 241 this.mockGlobals.expects(once()).recordEvent( |
| 242 DiagnosticEvent.EXTENSION_START); | 242 GoogleNowEvent.EXTENSION_START); |
| 243 | 243 |
| 244 expectInitialization(this.mockApis); | 244 expectInitialization(this.mockApis); |
| 245 | 245 |
| 246 expectStateMachineCalls( | 246 expectStateMachineCalls( |
| 247 this.mockApis, | 247 this.mockApis, |
| 248 testIdentityToken, | 248 testIdentityToken, |
| 249 testGeolocationPref, | 249 testGeolocationPref, |
| 250 testUserRespondedToToast); | 250 testUserRespondedToToast); |
| 251 | 251 |
| 252 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); | 252 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 269 | 269 |
| 270 // Setup and expectations. | 270 // Setup and expectations. |
| 271 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; | 271 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; |
| 272 var testIdentityToken = 'some identity token'; | 272 var testIdentityToken = 'some identity token'; |
| 273 var testGeolocationPref = true; | 273 var testGeolocationPref = true; |
| 274 var testUserRespondedToToast = {userRespondedToToast: true}; | 274 var testUserRespondedToToast = {userRespondedToToast: true}; |
| 275 | 275 |
| 276 mockInitializeDependencies(this); | 276 mockInitializeDependencies(this); |
| 277 | 277 |
| 278 this.mockGlobals.expects(once()).recordEvent( | 278 this.mockGlobals.expects(once()).recordEvent( |
| 279 DiagnosticEvent.EXTENSION_START); | 279 GoogleNowEvent.EXTENSION_START); |
| 280 | 280 |
| 281 expectInitialization(this.mockApis); | 281 expectInitialization(this.mockApis); |
| 282 | 282 |
| 283 expectStateMachineCalls( | 283 expectStateMachineCalls( |
| 284 this.mockApis, | 284 this.mockApis, |
| 285 testIdentityToken, | 285 testIdentityToken, |
| 286 testGeolocationPref, | 286 testGeolocationPref, |
| 287 testUserRespondedToToast); | 287 testUserRespondedToToast); |
| 288 | 288 |
| 289 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); | 289 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 306 | 306 |
| 307 // Setup and expectations. | 307 // Setup and expectations. |
| 308 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; | 308 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; |
| 309 var testIdentityToken = 'some identity token'; | 309 var testIdentityToken = 'some identity token'; |
| 310 var testGeolocationPref = false; | 310 var testGeolocationPref = false; |
| 311 var testUserRespondedToToast = {userRespondedToToast: true}; | 311 var testUserRespondedToToast = {userRespondedToToast: true}; |
| 312 | 312 |
| 313 mockInitializeDependencies(this); | 313 mockInitializeDependencies(this); |
| 314 | 314 |
| 315 this.mockGlobals.expects(once()).recordEvent( | 315 this.mockGlobals.expects(once()).recordEvent( |
| 316 DiagnosticEvent.EXTENSION_START); | 316 GoogleNowEvent.EXTENSION_START); |
| 317 | 317 |
| 318 expectInitialization(this.mockApis); | 318 expectInitialization(this.mockApis); |
| 319 | 319 |
| 320 expectStateMachineCalls( | 320 expectStateMachineCalls( |
| 321 this.mockApis, | 321 this.mockApis, |
| 322 testIdentityToken, | 322 testIdentityToken, |
| 323 testGeolocationPref, | 323 testGeolocationPref, |
| 324 testUserRespondedToToast); | 324 testUserRespondedToToast); |
| 325 | 325 |
| 326 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); | 326 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), | 507 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), |
| 508 chromeTabsCreateSavedArgs.match(ANYTHING)). | 508 chromeTabsCreateSavedArgs.match(ANYTHING)). |
| 509 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); | 509 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); |
| 510 this.mockApis.expects(once()).chrome_windows_create( | 510 this.mockApis.expects(once()).chrome_windows_create( |
| 511 eqJSON({url: testActionUrl})); | 511 eqJSON({url: testActionUrl})); |
| 512 | 512 |
| 513 // Invoking the tested function. | 513 // Invoking the tested function. |
| 514 onNotificationClicked( | 514 onNotificationClicked( |
| 515 testNotificationId, this.mockLocalFunctions.functions().selector); | 515 testNotificationId, this.mockLocalFunctions.functions().selector); |
| 516 }); | 516 }); |
| OLD | NEW |