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 cards.js. | 6 * Test fixture for cards.js. |
7 * @constructor | 7 * @constructor |
8 * @extends {testing.Test} | 8 * @extends {testing.Test} |
9 */ | 9 */ |
10 function GoogleNowCardsUnitTest () { | 10 function GoogleNowCardsUnitTest () { |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 var testCardId = 'TEST CARD ID'; | 23 var testCardId = 'TEST CARD ID'; |
24 var testNotification = {testNotificationField: 'TEST NOTIFICATION VALUE'}; | 24 var testNotification = {testNotificationField: 'TEST NOTIFICATION VALUE'}; |
25 var expectedShowAlarmId = 'card-show-TEST CARD ID'; | 25 var expectedShowAlarmId = 'card-show-TEST CARD ID'; |
26 var expectedHideAlarmId = 'card-hide-TEST CARD ID'; | 26 var expectedHideAlarmId = 'card-hide-TEST CARD ID'; |
27 var testActionUrls = {testField: 'TEST VALUE'}; | 27 var testActionUrls = {testField: 'TEST VALUE'}; |
28 var testDismissal = {testDismissalField: 'TEST DISMISSAL VALUE'}; | 28 var testDismissal = {testDismissalField: 'TEST DISMISSAL VALUE'}; |
29 | 29 |
30 function setUpCardManagerTest(fixture) { | 30 function setUpCardManagerTest(fixture) { |
31 fixture.makeAndRegisterMockApis([ | 31 fixture.makeAndRegisterMockApis([ |
32 'chrome.alarms.onAlarm.addListener', | |
33 'chrome.alarms.clear', | 32 'chrome.alarms.clear', |
34 'chrome.alarms.create', | 33 'chrome.alarms.create', |
35 'chrome.notifications.clear', | 34 'chrome.notifications.clear', |
36 'chrome.notifications.create', | 35 'instrumented.alarms.onAlarm.addListener', |
37 'chrome.notifications.update', | 36 'instrumented.notifications.create', |
38 'storage.get' | 37 'instrumented.notifications.update', |
| 38 'instrumented.storage.local.get' |
39 ]); | 39 ]); |
40 | 40 |
41 chrome.runtime = {}; // No error. | 41 chrome.runtime = {}; // No error. |
42 | 42 |
43 var onAlarmSavedArgs = new SaveMockArguments(); | 43 var onAlarmSavedArgs = new SaveMockArguments(); |
44 fixture.mockApis.expects(once()). | 44 fixture.mockApis.expects(once()). |
45 chrome_alarms_onAlarm_addListener( | 45 instrumented_alarms_onAlarm_addListener( |
46 onAlarmSavedArgs.match(ANYTHING)); | 46 onAlarmSavedArgs.match(ANYTHING)); |
47 | 47 |
48 var cardSet = buildCardSet(); | 48 var cardSet = buildCardSet(); |
49 | 49 |
50 Mock4JS.verifyAllMocks(); | 50 Mock4JS.verifyAllMocks(); |
51 | 51 |
52 Date.now = function() { return 300000; }; | 52 Date.now = function() { return 300000; }; |
53 | 53 |
54 var test = { | 54 var test = { |
55 cardSet: cardSet, | 55 cardSet: cardSet, |
(...skipping 15 matching lines...) Expand all Loading... |
71 // Creates a new card with no trigger. | 71 // Creates a new card with no trigger. |
72 | 72 |
73 // Setup and expectations. | 73 // Setup and expectations. |
74 var test = setUpCardManagerTest(this); | 74 var test = setUpCardManagerTest(this); |
75 this.mockApis.expects(once()). | 75 this.mockApis.expects(once()). |
76 chrome_alarms_clear(expectedHideAlarmId); | 76 chrome_alarms_clear(expectedHideAlarmId); |
77 this.mockApis.expects(once()). | 77 this.mockApis.expects(once()). |
78 chrome_alarms_clear(expectedShowAlarmId); | 78 chrome_alarms_clear(expectedShowAlarmId); |
79 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 79 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); |
80 this.mockApis.expects(once()). | 80 this.mockApis.expects(once()). |
81 chrome_notifications_create( | 81 instrumented_notifications_create( |
82 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 82 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), |
83 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 83 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), |
84 chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 84 chromeNotificationsCreateSavedArgs.match(ANYTHING)). |
85 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); | 85 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); |
86 | 86 |
87 // Call tested method. | 87 // Call tested method. |
88 var notificationData = test.cardSet.update({ | 88 var notificationData = test.cardSet.update({ |
89 notificationId: testCardId, | 89 notificationId: testCardId, |
90 notification: testNotification, | 90 notification: testNotification, |
91 actionUrls: testActionUrls, | 91 actionUrls: testActionUrls, |
92 dismissal: testDismissal, | 92 dismissal: testDismissal, |
93 version: 0}); | 93 version: 0}); |
94 | 94 |
95 // Check the return value. | 95 // Check the return value. |
96 assertEquals( | 96 assertEquals( |
97 JSON.stringify({ | 97 JSON.stringify({ |
98 actionUrls: testActionUrls, | 98 actionUrls: testActionUrls, |
99 cardCreateInfo: { | 99 cardCreateInfo: { |
100 notification: testNotification, | 100 notification: testNotification, |
101 timeHide: undefined, | 101 timeHide: undefined, |
102 version: 0 | 102 version: 0 |
103 }, | 103 }, |
104 dismissalParameters: testDismissal | 104 dismissalParameters: testDismissal |
105 }), | 105 }), |
106 JSON.stringify(notificationData)); | 106 JSON.stringify(notificationData)); |
107 }); | 107 }); |
108 | 108 |
109 TEST_F('GoogleNowCardsUnitTest', 'CreateCardEmptyTrigger', function() { | 109 TEST_F('GoogleNowCardsUnitTest', 'CreateCardEmptyTrigger', function() { |
110 // Creates a new card with empty trigger. | 110 // Creates a new card with empty trigger. |
111 | 111 |
112 // Setup and expectations. | 112 // Setup and expectations. |
113 var test = setUpCardManagerTest(this); | 113 var test = setUpCardManagerTest(this); |
114 this.mockApis.expects(once()). | 114 this.mockApis.expects(once()). |
115 chrome_alarms_clear(expectedHideAlarmId); | 115 chrome_alarms_clear(expectedHideAlarmId); |
116 this.mockApis.expects(once()). | 116 this.mockApis.expects(once()). |
117 chrome_alarms_clear(expectedShowAlarmId); | 117 chrome_alarms_clear(expectedShowAlarmId); |
118 this.mockApis.expects(once()). | 118 this.mockApis.expects(once()). |
119 chrome_notifications_create( | 119 instrumented_notifications_create( |
120 testCardId, eqJSON(testNotification), ANYTHING); | 120 testCardId, eqJSON(testNotification), ANYTHING); |
121 | 121 |
122 // Call tested method. | 122 // Call tested method. |
123 var notificationData = test.cardSet.update({ | 123 var notificationData = test.cardSet.update({ |
124 notificationId: testCardId, | 124 notificationId: testCardId, |
125 notification: testNotification, | 125 notification: testNotification, |
126 actionUrls: testActionUrls, | 126 actionUrls: testActionUrls, |
127 dismissal: testDismissal, | 127 dismissal: testDismissal, |
128 version: 0, | 128 version: 0, |
129 trigger: {}}); | 129 trigger: {}}); |
(...skipping 16 matching lines...) Expand all Loading... |
146 // Creates a new card with trigger specifying hide time. | 146 // Creates a new card with trigger specifying hide time. |
147 | 147 |
148 // Setup and expectations. | 148 // Setup and expectations. |
149 var test = setUpCardManagerTest(this); | 149 var test = setUpCardManagerTest(this); |
150 this.mockApis.expects(once()). | 150 this.mockApis.expects(once()). |
151 chrome_alarms_clear(expectedHideAlarmId); | 151 chrome_alarms_clear(expectedHideAlarmId); |
152 this.mockApis.expects(once()). | 152 this.mockApis.expects(once()). |
153 chrome_alarms_clear(expectedShowAlarmId); | 153 chrome_alarms_clear(expectedShowAlarmId); |
154 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 154 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); |
155 this.mockApis.expects(once()). | 155 this.mockApis.expects(once()). |
156 chrome_notifications_create( | 156 instrumented_notifications_create( |
157 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 157 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), |
158 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 158 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), |
159 chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 159 chromeNotificationsCreateSavedArgs.match(ANYTHING)). |
160 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); | 160 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); |
161 this.mockApis.expects(once()). | 161 this.mockApis.expects(once()). |
162 chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 1313000})); | 162 chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 1313000})); |
163 | 163 |
164 // Call tested method. | 164 // Call tested method. |
165 var notificationData = test.cardSet.update({ | 165 var notificationData = test.cardSet.update({ |
166 notificationId: testCardId, | 166 notificationId: testCardId, |
(...skipping 21 matching lines...) Expand all Loading... |
188 // Updates a card with another card with same version. | 188 // Updates a card with another card with same version. |
189 | 189 |
190 // Setup and expectations. | 190 // Setup and expectations. |
191 var test = setUpCardManagerTest(this); | 191 var test = setUpCardManagerTest(this); |
192 this.mockApis.expects(once()). | 192 this.mockApis.expects(once()). |
193 chrome_alarms_clear(expectedHideAlarmId); | 193 chrome_alarms_clear(expectedHideAlarmId); |
194 this.mockApis.expects(once()). | 194 this.mockApis.expects(once()). |
195 chrome_alarms_clear(expectedShowAlarmId); | 195 chrome_alarms_clear(expectedShowAlarmId); |
196 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 196 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); |
197 this.mockApis.expects(once()). | 197 this.mockApis.expects(once()). |
198 chrome_notifications_update( | 198 instrumented_notifications_update( |
199 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 199 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), |
200 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 200 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), |
201 chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 201 chromeNotificationsCreateSavedArgs.match(ANYTHING)). |
202 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, true)); | 202 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, true)); |
203 | 203 |
204 // Call tested method. | 204 // Call tested method. |
205 var notificationData = test.cardSet.update({ | 205 var notificationData = test.cardSet.update({ |
206 notificationId: testCardId, | 206 notificationId: testCardId, |
207 notification: testNotification, | 207 notification: testNotification, |
208 actionUrls: testActionUrls, | 208 actionUrls: testActionUrls, |
(...skipping 20 matching lines...) Expand all Loading... |
229 // time. | 229 // time. |
230 | 230 |
231 // Setup and expectations. | 231 // Setup and expectations. |
232 var test = setUpCardManagerTest(this); | 232 var test = setUpCardManagerTest(this); |
233 this.mockApis.expects(once()). | 233 this.mockApis.expects(once()). |
234 chrome_alarms_clear(expectedHideAlarmId); | 234 chrome_alarms_clear(expectedHideAlarmId); |
235 this.mockApis.expects(once()). | 235 this.mockApis.expects(once()). |
236 chrome_alarms_clear(expectedShowAlarmId); | 236 chrome_alarms_clear(expectedShowAlarmId); |
237 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 237 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); |
238 this.mockApis.expects(once()). | 238 this.mockApis.expects(once()). |
239 chrome_notifications_update( | 239 instrumented_notifications_update( |
240 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 240 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), |
241 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 241 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), |
242 chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 242 chromeNotificationsCreateSavedArgs.match(ANYTHING)). |
243 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); | 243 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); |
244 this.mockApis.expects(once()). | 244 this.mockApis.expects(once()). |
245 chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 1313000})); | 245 chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 1313000})); |
246 | 246 |
247 // Call tested method. | 247 // Call tested method. |
248 test.cardSet.update({ | 248 test.cardSet.update({ |
249 notificationId: testCardId, | 249 notificationId: testCardId, |
250 notification: testNotification, | 250 notification: testNotification, |
251 actionUrls: testActionUrls, | 251 actionUrls: testActionUrls, |
252 dismissal: testDismissal, | 252 dismissal: testDismissal, |
253 version: 0, | 253 version: 0, |
254 trigger: {hideTimeSec: 1013}}, | 254 trigger: {hideTimeSec: 1013}}, |
255 0); | 255 0); |
256 }); | 256 }); |
257 | 257 |
258 TEST_F('GoogleNowCardsUnitTest', 'UpdateCardDifferentVersion', function() { | 258 TEST_F('GoogleNowCardsUnitTest', 'UpdateCardDifferentVersion', function() { |
259 // Updates a card with another card with different version. | 259 // Updates a card with another card with different version. |
260 | 260 |
261 // Setup and expectations. | 261 // Setup and expectations. |
262 var test = setUpCardManagerTest(this); | 262 var test = setUpCardManagerTest(this); |
263 this.mockApis.expects(once()). | 263 this.mockApis.expects(once()). |
264 chrome_alarms_clear(expectedHideAlarmId); | 264 chrome_alarms_clear(expectedHideAlarmId); |
265 this.mockApis.expects(once()). | 265 this.mockApis.expects(once()). |
266 chrome_alarms_clear(expectedShowAlarmId); | 266 chrome_alarms_clear(expectedShowAlarmId); |
267 this.mockApis.expects(once()). | 267 this.mockApis.expects(once()). |
268 chrome_notifications_create( | 268 instrumented_notifications_create( |
269 testCardId, eqJSON(testNotification), ANYTHING); | 269 testCardId, eqJSON(testNotification), ANYTHING); |
270 | 270 |
271 // Call tested method. | 271 // Call tested method. |
272 test.cardSet.update({ | 272 test.cardSet.update({ |
273 notificationId: testCardId, | 273 notificationId: testCardId, |
274 notification: testNotification, | 274 notification: testNotification, |
275 actionUrls: testActionUrls, | 275 actionUrls: testActionUrls, |
276 dismissal: testDismissal, | 276 dismissal: testDismissal, |
277 version: 0}, | 277 version: 0}, |
278 1); | 278 1); |
279 }); | 279 }); |
280 | 280 |
281 TEST_F('GoogleNowCardsUnitTest', 'CreateCardTriggerShowNow', function() { | 281 TEST_F('GoogleNowCardsUnitTest', 'CreateCardTriggerShowNow', function() { |
282 // Creates a new card with trigger that requires showing the card immediately. | 282 // Creates a new card with trigger that requires showing the card immediately. |
283 | 283 |
284 // Setup and expectations. | 284 // Setup and expectations. |
285 var test = setUpCardManagerTest(this); | 285 var test = setUpCardManagerTest(this); |
286 this.mockApis.expects(once()). | 286 this.mockApis.expects(once()). |
287 chrome_alarms_clear(expectedHideAlarmId); | 287 chrome_alarms_clear(expectedHideAlarmId); |
288 this.mockApis.expects(once()). | 288 this.mockApis.expects(once()). |
289 chrome_alarms_clear(expectedShowAlarmId); | 289 chrome_alarms_clear(expectedShowAlarmId); |
290 this.mockApis.expects(once()). | 290 this.mockApis.expects(once()). |
291 chrome_notifications_create( | 291 instrumented_notifications_create( |
292 testCardId, eqJSON(testNotification), ANYTHING); | 292 testCardId, eqJSON(testNotification), ANYTHING); |
293 | 293 |
294 // Call tested method. | 294 // Call tested method. |
295 test.cardSet.update({ | 295 test.cardSet.update({ |
296 notificationId: testCardId, | 296 notificationId: testCardId, |
297 notification: testNotification, | 297 notification: testNotification, |
298 actionUrls: testActionUrls, | 298 actionUrls: testActionUrls, |
299 dismissal: testDismissal, | 299 dismissal: testDismissal, |
300 version: 0, | 300 version: 0, |
301 trigger: {showTimeSec: 0}}); | 301 trigger: {showTimeSec: 0}}); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 344 |
345 // Call tested method. | 345 // Call tested method. |
346 test.alarmCallback({name: 'unrelated'}); | 346 test.alarmCallback({name: 'unrelated'}); |
347 }); | 347 }); |
348 | 348 |
349 TEST_F('GoogleNowCardsUnitTest', 'onAlarmShowNoData', function() { | 349 TEST_F('GoogleNowCardsUnitTest', 'onAlarmShowNoData', function() { |
350 // Tests onAlarm for the 'show' alarm when there is no data for the card. | 350 // Tests onAlarm for the 'show' alarm when there is no data for the card. |
351 var test = setUpCardManagerTest(this); | 351 var test = setUpCardManagerTest(this); |
352 var storageGetSavedArgs = new SaveMockArguments(); | 352 var storageGetSavedArgs = new SaveMockArguments(); |
353 this.mockApis.expects(once()). | 353 this.mockApis.expects(once()). |
354 storage_get( | 354 instrumented_storage_local_get( |
355 storageGetSavedArgs.match(eq('notificationsData')), | 355 storageGetSavedArgs.match(eq('notificationsData')), |
356 storageGetSavedArgs.match(ANYTHING)). | 356 storageGetSavedArgs.match(ANYTHING)). |
357 will(invokeCallback(storageGetSavedArgs, 1, {})); | 357 will(invokeCallback(storageGetSavedArgs, 1, {})); |
358 | 358 |
359 // Call tested method. | 359 // Call tested method. |
360 test.alarmCallback({name: expectedShowAlarmId}); | 360 test.alarmCallback({name: expectedShowAlarmId}); |
361 }); | 361 }); |
362 | 362 |
363 TEST_F('GoogleNowCardsUnitTest', 'onAlarmShowHasDataCreate', function() { | 363 TEST_F('GoogleNowCardsUnitTest', 'onAlarmShowHasDataCreate', function() { |
364 // Tests onAlarm for the 'show' alarm when there is data for the card. The | 364 // Tests onAlarm for the 'show' alarm when there is data for the card. The |
365 // notification will be created because there is no previous version. | 365 // notification will be created because there is no previous version. |
366 var test = setUpCardManagerTest(this); | 366 var test = setUpCardManagerTest(this); |
367 var storageGetSavedArgs = new SaveMockArguments(); | 367 var storageGetSavedArgs = new SaveMockArguments(); |
368 this.mockApis.expects(once()). | 368 this.mockApis.expects(once()). |
369 storage_get( | 369 instrumented_storage_local_get( |
370 storageGetSavedArgs.match(eq('notificationsData')), | 370 storageGetSavedArgs.match(eq('notificationsData')), |
371 storageGetSavedArgs.match(ANYTHING)). | 371 storageGetSavedArgs.match(ANYTHING)). |
372 will(invokeCallback( | 372 will(invokeCallback( |
373 storageGetSavedArgs, | 373 storageGetSavedArgs, |
374 1, | 374 1, |
375 { | 375 { |
376 notificationsData: { | 376 notificationsData: { |
377 'TEST CARD ID': { | 377 'TEST CARD ID': { |
378 actionUrls: testActionUrls, | 378 actionUrls: testActionUrls, |
379 cardCreateInfo: { | 379 cardCreateInfo: { |
380 notification: testNotification, | 380 notification: testNotification, |
381 timeHide: 1313000, | 381 timeHide: 1313000, |
382 version: 0}}}})); | 382 version: 0}}}})); |
383 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 383 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); |
384 this.mockApis.expects(once()). | 384 this.mockApis.expects(once()). |
385 chrome_notifications_create( | 385 instrumented_notifications_create( |
386 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 386 chromeNotificationsCreateSavedArgs.match(eq(testCardId)), |
387 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 387 chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), |
388 chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 388 chromeNotificationsCreateSavedArgs.match(ANYTHING)). |
389 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); | 389 will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); |
390 this.mockApis.expects(once()). | 390 this.mockApis.expects(once()). |
391 chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 1313000})); | 391 chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 1313000})); |
392 | 392 |
393 // Call tested method. | 393 // Call tested method. |
394 test.alarmCallback({name: expectedShowAlarmId}); | 394 test.alarmCallback({name: expectedShowAlarmId}); |
395 }); | 395 }); |
396 | 396 |
397 TEST_F('GoogleNowCardsUnitTest', 'onAlarmShowHasDataUpdate', function() { | 397 TEST_F('GoogleNowCardsUnitTest', 'onAlarmShowHasDataUpdate', function() { |
398 // Tests onAlarm for the 'show' alarm when there is data for the card. The | 398 // Tests onAlarm for the 'show' alarm when there is data for the card. The |
399 // notification will be updated because previous version is same as current. | 399 // notification will be updated because previous version is same as current. |
400 var test = setUpCardManagerTest(this); | 400 var test = setUpCardManagerTest(this); |
401 var storageGetSavedArgs = new SaveMockArguments(); | 401 var storageGetSavedArgs = new SaveMockArguments(); |
402 this.mockApis.expects(once()). | 402 this.mockApis.expects(once()). |
403 storage_get( | 403 instrumented_storage_local_get( |
404 storageGetSavedArgs.match(eq('notificationsData')), | 404 storageGetSavedArgs.match(eq('notificationsData')), |
405 storageGetSavedArgs.match(ANYTHING)). | 405 storageGetSavedArgs.match(ANYTHING)). |
406 will(invokeCallback( | 406 will(invokeCallback( |
407 storageGetSavedArgs, | 407 storageGetSavedArgs, |
408 1, | 408 1, |
409 { | 409 { |
410 notificationsData: { | 410 notificationsData: { |
411 'TEST CARD ID': { | 411 'TEST CARD ID': { |
412 actionUrls: testActionUrls, | 412 actionUrls: testActionUrls, |
413 cardCreateInfo: { | 413 cardCreateInfo: { |
414 notification: testNotification, | 414 notification: testNotification, |
415 timeHide: 1313000, | 415 timeHide: 1313000, |
416 version: 0, | 416 version: 0, |
417 previousVersion:0}}}})); | 417 previousVersion:0}}}})); |
418 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 418 var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); |
419 this.mockApis.expects(once()). | 419 this.mockApis.expects(once()). |
420 chrome_notifications_update( | 420 instrumented_notifications_update( |
421 testCardId, eqJSON(testNotification), ANYTHING); | 421 testCardId, eqJSON(testNotification), ANYTHING); |
422 | 422 |
423 // Call tested method. | 423 // Call tested method. |
424 test.alarmCallback({name: expectedShowAlarmId}); | 424 test.alarmCallback({name: expectedShowAlarmId}); |
425 }); | 425 }); |
426 | 426 |
427 TEST_F('GoogleNowCardsUnitTest', 'onAlarmHide', function() { | 427 TEST_F('GoogleNowCardsUnitTest', 'onAlarmHide', function() { |
428 // Tests onAlarm for the 'hide' alarm. | 428 // Tests onAlarm for the 'hide' alarm. |
429 var test = setUpCardManagerTest(this); | 429 var test = setUpCardManagerTest(this); |
430 this.mockApis.expects(once()). | 430 this.mockApis.expects(once()). |
431 chrome_notifications_clear(testCardId, ANYTHING); | 431 chrome_notifications_clear(testCardId, ANYTHING); |
432 | 432 |
433 // Call tested method. | 433 // Call tested method. |
434 test.alarmCallback({name: expectedHideAlarmId}); | 434 test.alarmCallback({name: expectedHideAlarmId}); |
435 }); | 435 }); |
OLD | NEW |