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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 TEST_F('GoogleNowBackgroundUnitTest', 'AreTasksConflicting', function() { | 24 TEST_F('GoogleNowBackgroundUnitTest', 'AreTasksConflicting', function() { |
25 function testTaskPair(newTaskName, scheduledTaskName, expected) { | 25 function testTaskPair(newTaskName, scheduledTaskName, expected) { |
26 assertTrue(areTasksConflicting(newTaskName, scheduledTaskName) == expected, | 26 assertTrue(areTasksConflicting(newTaskName, scheduledTaskName) == expected, |
27 '(' + newTaskName + ', ' + scheduledTaskName + ')'); | 27 '(' + newTaskName + ', ' + scheduledTaskName + ')'); |
28 } | 28 } |
29 | 29 |
30 testTaskPair(UPDATE_CARDS_TASK_NAME, UPDATE_CARDS_TASK_NAME, true); | 30 testTaskPair(UPDATE_CARDS_TASK_NAME, UPDATE_CARDS_TASK_NAME, true); |
31 testTaskPair(UPDATE_CARDS_TASK_NAME, DISMISS_CARD_TASK_NAME, false); | 31 testTaskPair(UPDATE_CARDS_TASK_NAME, DISMISS_CARD_TASK_NAME, false); |
32 testTaskPair(UPDATE_CARDS_TASK_NAME, RETRY_DISMISS_TASK_NAME, false); | 32 testTaskPair(UPDATE_CARDS_TASK_NAME, RETRY_DISMISS_TASK_NAME, false); |
| 33 testTaskPair(UPDATE_CARDS_TASK_NAME, STATE_CHANGED_TASK_NAME, false); |
33 | 34 |
34 testTaskPair(DISMISS_CARD_TASK_NAME, UPDATE_CARDS_TASK_NAME, false); | 35 testTaskPair(DISMISS_CARD_TASK_NAME, UPDATE_CARDS_TASK_NAME, false); |
35 testTaskPair(DISMISS_CARD_TASK_NAME, DISMISS_CARD_TASK_NAME, false); | 36 testTaskPair(DISMISS_CARD_TASK_NAME, DISMISS_CARD_TASK_NAME, false); |
36 testTaskPair(DISMISS_CARD_TASK_NAME, RETRY_DISMISS_TASK_NAME, false); | 37 testTaskPair(DISMISS_CARD_TASK_NAME, RETRY_DISMISS_TASK_NAME, false); |
| 38 testTaskPair(DISMISS_CARD_TASK_NAME, STATE_CHANGED_TASK_NAME, false); |
37 | 39 |
38 testTaskPair(RETRY_DISMISS_TASK_NAME, UPDATE_CARDS_TASK_NAME, true); | 40 testTaskPair(RETRY_DISMISS_TASK_NAME, UPDATE_CARDS_TASK_NAME, true); |
39 testTaskPair(RETRY_DISMISS_TASK_NAME, DISMISS_CARD_TASK_NAME, true); | 41 testTaskPair(RETRY_DISMISS_TASK_NAME, DISMISS_CARD_TASK_NAME, true); |
40 testTaskPair(RETRY_DISMISS_TASK_NAME, RETRY_DISMISS_TASK_NAME, true); | 42 testTaskPair(RETRY_DISMISS_TASK_NAME, RETRY_DISMISS_TASK_NAME, true); |
| 43 testTaskPair(RETRY_DISMISS_TASK_NAME, STATE_CHANGED_TASK_NAME, false); |
| 44 |
| 45 testTaskPair(STATE_CHANGED_TASK_NAME, UPDATE_CARDS_TASK_NAME, false); |
| 46 testTaskPair(STATE_CHANGED_TASK_NAME, DISMISS_CARD_TASK_NAME, false); |
| 47 testTaskPair(STATE_CHANGED_TASK_NAME, RETRY_DISMISS_TASK_NAME, false); |
| 48 testTaskPair(STATE_CHANGED_TASK_NAME, STATE_CHANGED_TASK_NAME, false); |
41 }); | 49 }); |
42 | 50 |
43 /** | 51 /** |
44 * Mocks global functions and APIs that initialize() depends upon. | 52 * Mocks global functions and APIs that initialize() depends upon. |
45 * @param {Test} fixture Test fixture. | 53 * @param {Test} fixture Test fixture. |
46 */ | 54 */ |
47 function mockInitializeDependencies(fixture) { | 55 function mockInitializeDependencies(fixture) { |
48 fixture.makeAndRegisterMockGlobals([ | 56 fixture.makeAndRegisterMockGlobals([ |
49 'recordEvent', | 57 'recordEvent', |
50 'showWelcomeToast', | 58 'showWelcomeToast', |
51 'startPollingCards']); | 59 'startPollingCards' |
52 fixture.makeAndRegisterMockApis( | 60 ]); |
53 ['storage.get', 'chrome.identity.getAuthToken']); | 61 fixture.makeAndRegisterMockApis([ |
| 62 'chrome.identity.getAuthToken', |
| 63 'chrome.location.clearWatch', |
| 64 'chrome.notifications.getAll', |
| 65 'chrome.preferencesPrivate.googleGeolocationAccessEnabled.get', |
| 66 'storage.get', |
| 67 'storage.set', |
| 68 'tasks.add', |
| 69 'updateCardsAttempts.isRunning', |
| 70 'updateCardsAttempts.stop' |
| 71 ]); |
| 72 } |
| 73 |
| 74 /** |
| 75 * Sets up the test to expect the state machine calls and send |
| 76 * the specified state machine state. Currently used to test initialize(). |
| 77 * Note that this CAN NOT be used if any of the methods below are called |
| 78 * outside of this context with the same argument matchers. |
| 79 * expects() calls cannot be chained with the same argument matchers. |
| 80 * @param {object} mockApisObj Mock APIs Object. |
| 81 * @param {string} testIdentityToken getAuthToken callback token. |
| 82 * @param {boolean} testGeolocationPref Geolocation Preference callback value. |
| 83 * @param {boolean} testUserRespondedToToast User Response to toast |
| 84 & callback value. |
| 85 */ |
| 86 function expectStateMachineCalls( |
| 87 mockApisObj, |
| 88 testIdentityToken, |
| 89 testGeolocationPref, |
| 90 testUserRespondedToToast) { |
| 91 var chromeIdentityGetAuthTokenSavedArgs = new SaveMockArguments(); |
| 92 mockApisObj.expects(once()). |
| 93 chrome_identity_getAuthToken( |
| 94 chromeIdentityGetAuthTokenSavedArgs.match( |
| 95 eqJSON({interactive: false})), |
| 96 chromeIdentityGetAuthTokenSavedArgs.match(ANYTHING)). |
| 97 will(invokeCallback( |
| 98 chromeIdentityGetAuthTokenSavedArgs, 1, testIdentityToken)); |
| 99 |
| 100 var googleGeolocationPrefGetSavedArgs = new SaveMockArguments(); |
| 101 mockApisObj.expects(once()). |
| 102 chrome_preferencesPrivate_googleGeolocationAccessEnabled_get( |
| 103 googleGeolocationPrefGetSavedArgs.match(eqJSON({})), |
| 104 googleGeolocationPrefGetSavedArgs.match(ANYTHING)). |
| 105 will(invokeCallback( |
| 106 googleGeolocationPrefGetSavedArgs, 1, {value: testGeolocationPref})); |
| 107 |
| 108 var storageGetSavedArgs = new SaveMockArguments(); |
| 109 mockApisObj.expects(once()). |
| 110 storage_get( |
| 111 storageGetSavedArgs.match(eq('userRespondedToToast')), |
| 112 storageGetSavedArgs.match(ANYTHING)). |
| 113 will(invokeCallback(storageGetSavedArgs, 1, testUserRespondedToToast)); |
| 114 } |
| 115 |
| 116 /** |
| 117 * Sets up the test to expect the initialization calls that |
| 118 * initialize() invokes. |
| 119 * Note that this CAN NOT be used if any of the methods below are called |
| 120 * outside of this context with the same argument matchers. |
| 121 * expects() calls cannot be chained with the same argument matchers. |
| 122 */ |
| 123 function expectInitialization(mockApisObj) { |
| 124 mockApisObj.expects(once()). |
| 125 chrome_location_clearWatch(ANYTHING); |
| 126 mockApisObj.expects(once()). |
| 127 updateCardsAttempts_stop(); |
| 128 mockApisObj.expects(once()). |
| 129 storage_set(eqJSON({notificationsData: {}})); |
| 130 var tasksAddSavedArgs = new SaveMockArguments(); |
| 131 mockApisObj.expects(once()). |
| 132 tasks_add( |
| 133 tasksAddSavedArgs.match(ANYTHING), |
| 134 tasksAddSavedArgs.match(ANYTHING)). |
| 135 will(invokeCallback(tasksAddSavedArgs, 1, function() {})); |
| 136 var updateCardsAttemptsIsRunningSavedArgs = new SaveMockArguments(); |
| 137 mockApisObj.expects(once()). |
| 138 updateCardsAttempts_isRunning( |
| 139 updateCardsAttemptsIsRunningSavedArgs.match(ANYTHING)). |
| 140 will( |
| 141 invokeCallback( |
| 142 updateCardsAttemptsIsRunningSavedArgs, 0, false)); |
54 } | 143 } |
55 | 144 |
56 TEST_F( | 145 TEST_F( |
57 'GoogleNowBackgroundUnitTest', | 146 'GoogleNowBackgroundUnitTest', |
58 'Initialize_ToastStateEmpty1', | 147 'Initialize_ToastStateEmpty1', |
59 function() { | 148 function() { |
60 // Tests the case when toast state is empty and NOTIFICATION_CARDS_URL is | 149 // Tests the case when the user isn't signed in and NOTIFICATION_CARDS_URL |
61 // not set. In this case, the function should quietly exit after finding | 150 // is not set. Since NOTIFICATION_CARDS_URL is empty, |
62 // out that NOTIFICATION_CARDS_URL is empty. | 151 // nothing should start. |
63 | 152 |
64 // Setup and expectations. | 153 // Setup and expectations. |
65 var testToastState = {}; | |
66 NOTIFICATION_CARDS_URL = undefined; | 154 NOTIFICATION_CARDS_URL = undefined; |
| 155 var testIdentityToken = undefined; |
| 156 var testGeolocationPref = false; |
| 157 var testUserRespondedToToast = {}; |
67 | 158 |
68 mockInitializeDependencies(this); | 159 mockInitializeDependencies(this); |
69 | 160 |
70 this.mockGlobals.expects(once()).recordEvent( | 161 this.mockGlobals.expects(once()).recordEvent( |
71 DiagnosticEvent.EXTENSION_START); | 162 DiagnosticEvent.EXTENSION_START); |
72 var storageGetSavedArgs = new SaveMockArguments(); | 163 |
73 this.mockApis.expects(once()). | 164 expectInitialization(this.mockApis); |
74 storage_get( | 165 |
75 storageGetSavedArgs.match(eq('toastState')), | 166 expectStateMachineCalls( |
76 storageGetSavedArgs.match(ANYTHING)). | 167 this.mockApis, |
77 will(invokeCallback(storageGetSavedArgs, 1, testToastState)); | 168 testIdentityToken, |
| 169 testGeolocationPref, |
| 170 testUserRespondedToToast); |
| 171 |
| 172 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
| 173 this.mockApis.expects(exactly(2)). |
| 174 chrome_notifications_getAll( |
| 175 chromeNotificationGetAllSavedArgs.match(ANYTHING)). |
| 176 will( |
| 177 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {}), |
| 178 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {})); |
| 179 |
| 180 // TODO(robliao,vadimt): Determine the granularity of testing to perform. |
78 | 181 |
79 // Invoking the tested function. | 182 // Invoking the tested function. |
80 initialize(); | 183 initialize(); |
81 }); | 184 }); |
82 | 185 |
83 TEST_F( | 186 TEST_F( |
84 'GoogleNowBackgroundUnitTest', | 187 'GoogleNowBackgroundUnitTest', |
85 'Initialize_ToastStateEmpty2', | 188 'Initialize_ToastStateEmpty2', |
86 function() { | 189 function() { |
87 // Tests the case when toast state is empty and NOTIFICATION_CARDS_URL is | 190 // Tests the case when NOTIFICATION_CARDS_URL is but getAuthToken fails |
88 // set, but getAuthToken fails most likely because the user is not signed | 191 // most likely because the user is not signed in. In this case, the |
89 // in. In this case, the function should quietly exit after finding out | 192 // function should quietly exit after finding out that getAuthToken fails. |
90 // that getAuthToken fails. | |
91 | 193 |
92 // Setup and expectations. | 194 // Setup and expectations. |
93 var testToastState = {}; | |
94 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; | 195 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; |
95 var testIdentityToken = undefined; | 196 var testIdentityToken = undefined; |
| 197 var testGeolocationPref = false; |
| 198 var testUserRespondedToToast = {}; |
96 | 199 |
97 mockInitializeDependencies(this); | 200 mockInitializeDependencies(this); |
98 | 201 |
99 this.mockGlobals.expects(once()).recordEvent( | 202 this.mockGlobals.expects(once()).recordEvent( |
100 DiagnosticEvent.EXTENSION_START); | 203 DiagnosticEvent.EXTENSION_START); |
101 var storageGetSavedArgs = new SaveMockArguments(); | 204 |
102 this.mockApis.expects(once()). | 205 expectInitialization(this.mockApis); |
103 storage_get( | 206 |
104 storageGetSavedArgs.match(eq('toastState')), | 207 expectStateMachineCalls( |
105 storageGetSavedArgs.match(ANYTHING)). | 208 this.mockApis, |
106 will(invokeCallback(storageGetSavedArgs, 1, testToastState)); | 209 testIdentityToken, |
107 var chromeIdentityGetAuthTokenSavedArgs = new SaveMockArguments(); | 210 testGeolocationPref, |
108 this.mockApis.expects(once()). | 211 testUserRespondedToToast); |
109 chrome_identity_getAuthToken( | 212 |
110 chromeIdentityGetAuthTokenSavedArgs.match( | 213 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
111 eqJSON({interactive: false})), | 214 this.mockApis.expects(exactly(2)). |
112 chromeIdentityGetAuthTokenSavedArgs.match(ANYTHING)). | 215 chrome_notifications_getAll( |
113 will(invokeCallback( | 216 chromeNotificationGetAllSavedArgs.match(ANYTHING)). |
114 chromeIdentityGetAuthTokenSavedArgs, 1, testIdentityToken)); | 217 will( |
| 218 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {}), |
| 219 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {})); |
115 | 220 |
116 // Invoking the tested function. | 221 // Invoking the tested function. |
117 initialize(); | 222 initialize(); |
118 }); | 223 }); |
119 | 224 |
120 TEST_F( | 225 TEST_F( |
121 'GoogleNowBackgroundUnitTest', | 226 'GoogleNowBackgroundUnitTest', |
122 'Initialize_ToastStateEmpty3', | 227 'Initialize_ToastStateEmpty3', |
123 function() { | 228 function() { |
124 // Tests the case when toast state is empty and NOTIFICATION_CARDS_URL is | 229 // Tests the case when NOTIFICATION_CARDS_URL is set, getAuthToken |
125 // set, and getAuthToken succeeds. In this case, the function should | 230 // succeeds, and the user has never responded to the toast. |
126 // invoke showWelcomeToast(). | 231 // In this case, the function should invoke showWelcomeToast(). |
127 | 232 |
128 // Setup and expectations. | 233 // Setup and expectations. |
129 var testToastState = {}; | |
130 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; | 234 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; |
131 var testIdentityToken = 'some identity token'; | 235 var testIdentityToken = 'some identity token'; |
| 236 var testGeolocationPref = false; |
| 237 var testUserRespondedToToast = {}; |
132 | 238 |
133 mockInitializeDependencies(this); | 239 mockInitializeDependencies(this); |
134 | 240 |
135 this.mockGlobals.expects(once()).recordEvent( | 241 this.mockGlobals.expects(once()).recordEvent( |
136 DiagnosticEvent.EXTENSION_START); | 242 DiagnosticEvent.EXTENSION_START); |
137 var storageGetSavedArgs = new SaveMockArguments(); | 243 |
138 this.mockApis.expects(once()). | 244 expectInitialization(this.mockApis); |
139 storage_get( | 245 |
140 storageGetSavedArgs.match(eq('toastState')), | 246 expectStateMachineCalls( |
141 storageGetSavedArgs.match(ANYTHING)). | 247 this.mockApis, |
142 will(invokeCallback(storageGetSavedArgs, 1, testToastState)); | 248 testIdentityToken, |
143 var chromeIdentityGetAuthTokenSavedArgs = new SaveMockArguments(); | 249 testGeolocationPref, |
144 this.mockApis.expects(once()). | 250 testUserRespondedToToast); |
145 chrome_identity_getAuthToken( | 251 |
146 chromeIdentityGetAuthTokenSavedArgs.match( | 252 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
147 eqJSON({interactive: false})), | 253 this.mockApis.expects(exactly(2)). |
148 chromeIdentityGetAuthTokenSavedArgs.match(ANYTHING)). | 254 chrome_notifications_getAll( |
149 will(invokeCallback( | 255 chromeNotificationGetAllSavedArgs.match(ANYTHING)). |
150 chromeIdentityGetAuthTokenSavedArgs, 1, testIdentityToken)); | 256 will( |
| 257 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {}), |
| 258 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {})); |
| 259 |
151 this.mockGlobals.expects(once()).showWelcomeToast(); | 260 this.mockGlobals.expects(once()).showWelcomeToast(); |
152 | 261 |
153 // Invoking the tested function. | 262 // Invoking the tested function. |
154 initialize(); | 263 initialize(); |
155 }); | 264 }); |
156 | 265 |
157 TEST_F('GoogleNowBackgroundUnitTest', 'Initialize_ToastStateYes', function() { | 266 TEST_F('GoogleNowBackgroundUnitTest', 'Initialize_RunGoogleNow', function() { |
158 // Tests the case when the user has answered "yes" to the toast in the past. | 267 // Tests if Google Now will invoke startPollingCards when all |
159 // In this case, the function should invoke startPollingCards(). | 268 // of the required state is fulfilled. |
160 | 269 |
161 // Setup and expectations. | 270 // Setup and expectations. |
162 var testToastState = {toastState: ToastOptionResponse.CHOSE_YES}; | 271 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; |
| 272 var testIdentityToken = 'some identity token'; |
| 273 var testGeolocationPref = true; |
| 274 var testUserRespondedToToast = {userRespondedToToast: true}; |
163 | 275 |
164 mockInitializeDependencies(this); | 276 mockInitializeDependencies(this); |
165 | 277 |
166 this.mockGlobals.expects(once()).recordEvent(DiagnosticEvent.EXTENSION_START); | 278 this.mockGlobals.expects(once()).recordEvent( |
167 var storageGetSavedArgs = new SaveMockArguments(); | 279 DiagnosticEvent.EXTENSION_START); |
168 this.mockApis.expects(once()). | 280 |
169 storage_get( | 281 expectInitialization(this.mockApis); |
170 storageGetSavedArgs.match(eq('toastState')), | 282 |
171 storageGetSavedArgs.match(ANYTHING)). | 283 expectStateMachineCalls( |
172 will(invokeCallback(storageGetSavedArgs, 1, testToastState)); | 284 this.mockApis, |
| 285 testIdentityToken, |
| 286 testGeolocationPref, |
| 287 testUserRespondedToToast); |
| 288 |
| 289 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
| 290 this.mockApis.expects(exactly(2)). |
| 291 chrome_notifications_getAll( |
| 292 chromeNotificationGetAllSavedArgs.match(ANYTHING)). |
| 293 will( |
| 294 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {}), |
| 295 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {})); |
| 296 |
173 this.mockGlobals.expects(once()).startPollingCards(); | 297 this.mockGlobals.expects(once()).startPollingCards(); |
174 | 298 |
175 // Invoking the tested function. | 299 // Invoking the tested function. |
176 initialize(); | 300 initialize(); |
177 }); | 301 }); |
178 | 302 |
179 TEST_F('GoogleNowBackgroundUnitTest', 'Initialize_ToastStateNo', function() { | 303 TEST_F('GoogleNowBackgroundUnitTest', 'Initialize_NoGeolocation', function() { |
180 // Tests the case when the user has answered "no" to the toast in the past. | 304 // Tests the case where everything is in place except for the |
181 // In this case, the function should do nothing. | 305 // Geolocation Preference after the user responded to the toast. |
182 | 306 |
183 // Setup and expectations. | 307 // Setup and expectations. |
184 var testToastState = {toastState: ToastOptionResponse.CHOSE_NO}; | 308 NOTIFICATION_CARDS_URL = 'https://some.server.url.com'; |
| 309 var testIdentityToken = 'some identity token'; |
| 310 var testGeolocationPref = false; |
| 311 var testUserRespondedToToast = {userRespondedToToast: true}; |
185 | 312 |
186 mockInitializeDependencies(this); | 313 mockInitializeDependencies(this); |
187 | 314 |
188 this.mockGlobals.expects(once()).recordEvent(DiagnosticEvent.EXTENSION_START); | 315 this.mockGlobals.expects(once()).recordEvent( |
189 var storageGetSavedArgs = new SaveMockArguments(); | 316 DiagnosticEvent.EXTENSION_START); |
190 this.mockApis.expects(once()). | 317 |
191 storage_get( | 318 expectInitialization(this.mockApis); |
192 storageGetSavedArgs.match(eq('toastState')), | 319 |
193 storageGetSavedArgs.match(ANYTHING)). | 320 expectStateMachineCalls( |
194 will(invokeCallback(storageGetSavedArgs, 1, testToastState)); | 321 this.mockApis, |
| 322 testIdentityToken, |
| 323 testGeolocationPref, |
| 324 testUserRespondedToToast); |
| 325 |
| 326 var chromeNotificationGetAllSavedArgs = new SaveMockArguments(); |
| 327 this.mockApis.expects(exactly(2)). |
| 328 chrome_notifications_getAll( |
| 329 chromeNotificationGetAllSavedArgs.match(ANYTHING)). |
| 330 will( |
| 331 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {}), |
| 332 invokeCallback(chromeNotificationGetAllSavedArgs, 0, {})); |
195 | 333 |
196 // Invoking the tested function. | 334 // Invoking the tested function. |
197 initialize(); | 335 initialize(); |
198 }); | 336 }); |
199 | 337 |
200 /** | 338 /** |
201 * Mocks global functions and APIs that onNotificationClicked() depends upon. | 339 * Mocks global functions and APIs that onNotificationClicked() depends upon. |
202 * @param {Test} fixture Test fixture. | 340 * @param {Test} fixture Test fixture. |
203 */ | 341 */ |
204 function mockOnNotificationClickedDependencies(fixture) { | 342 function mockOnNotificationClickedDependencies(fixture) { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), | 507 chromeTabsCreateSavedArgs.match(eqJSON({url: testActionUrl})), |
370 chromeTabsCreateSavedArgs.match(ANYTHING)). | 508 chromeTabsCreateSavedArgs.match(ANYTHING)). |
371 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); | 509 will(invokeCallback(chromeTabsCreateSavedArgs, 1, testCreatedTab)); |
372 this.mockApis.expects(once()).chrome_windows_create( | 510 this.mockApis.expects(once()).chrome_windows_create( |
373 eqJSON({url: testActionUrl})); | 511 eqJSON({url: testActionUrl})); |
374 | 512 |
375 // Invoking the tested function. | 513 // Invoking the tested function. |
376 onNotificationClicked( | 514 onNotificationClicked( |
377 testNotificationId, this.mockLocalFunctions.functions().selector); | 515 testNotificationId, this.mockLocalFunctions.functions().selector); |
378 }); | 516 }); |
OLD | NEW |