OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // If you set this variable to true, then compile and run Chrome, all messages | 5 // If you set this variable to true, then compile and run Chrome, all messages |
6 // sent with chrome.send() will be intercepted and their callback data will be | 6 // sent with chrome.send() will be intercepted and their callback data will be |
7 // recorded. You can later see the recorded data by executing chrome.mock() | 7 // recorded. You can later see the recorded data by executing chrome.mock() |
8 // on Web Developer Tools' console. | 8 // on Web Developer Tools' console. |
9 var recordMockData = false; | 9 var recordMockData = false; |
10 | 10 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 236 } |
237 dispatchCallbackForMessage('getMostVisited'); | 237 dispatchCallbackForMessage('getMostVisited'); |
238 }, | 238 }, |
239 | 239 |
240 clearMostVisitedURLsBlacklist: function() { | 240 clearMostVisitedURLsBlacklist: function() { |
241 mostVisitedBlackList = {}; | 241 mostVisitedBlackList = {}; |
242 dispatchCallbackForMessage('getMostVisited'); | 242 dispatchCallbackForMessage('getMostVisited'); |
243 }, | 243 }, |
244 | 244 |
245 uninstallApp: function(id) { | 245 uninstallApp: function(id) { |
246 var appData; | 246 var removedData; |
247 var data = dataMap['getApps'][0].apps; | 247 var data = dataMap['getApps'][0].apps; |
248 for (var i = 0, length = data.length; i < length; i++) { | 248 for (var i = 0, length = data.length; i < length; i++) { |
249 if (data[i].id == id) { | 249 if (data[i].id == id) { |
250 appData = data[i]; | 250 removedData = data[i]; |
251 data.splice(i, 1); | 251 data.splice(i, 1); |
252 break; | 252 break; |
253 } | 253 } |
254 } | 254 } |
255 assert(appData); | 255 assert(removedData); |
256 dataMap['appRemoved'] = [appData, true, true]; | 256 dataMap['appRemoved'] = [removedData, true, true]; |
257 dispatchCallbackForMessage('appRemoved'); | 257 dispatchCallbackForMessage('appRemoved'); |
258 }, | 258 }, |
259 }; | 259 }; |
260 | 260 |
261 //---------------------------------------------------------------------------- | 261 //---------------------------------------------------------------------------- |
262 // Debug | 262 // Debug |
263 //---------------------------------------------------------------------------- | 263 //---------------------------------------------------------------------------- |
264 | 264 |
265 var debugArgs = { | 265 var debugArgs = { |
266 debug: false, | 266 debug: false, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 354 |
355 //---------------------------------------------------------------------------- | 355 //---------------------------------------------------------------------------- |
356 // ChromeMock initialization | 356 // ChromeMock initialization |
357 //---------------------------------------------------------------------------- | 357 //---------------------------------------------------------------------------- |
358 | 358 |
359 if (shouldRegisterData) | 359 if (shouldRegisterData) |
360 interceptLoadData(); | 360 interceptLoadData(); |
361 | 361 |
362 window.chrome = ChromeMock; | 362 window.chrome = ChromeMock; |
363 })(); | 363 })(); |
OLD | NEW |