Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * Mock out the chrome.fileBrowserPrivate API for use in the harness. | 6 * Mock out the chrome.fileBrowserPrivate API for use in the harness. |
| 7 */ | 7 */ |
| 8 chrome.fileBrowserPrivate = { | 8 chrome.fileBrowserPrivate = { |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 for (var taskIndex = candidateTasks.length - 1; taskIndex >= 0; | 101 for (var taskIndex = candidateTasks.length - 1; taskIndex >= 0; |
| 102 taskIndex--) { | 102 taskIndex--) { |
| 103 if (candidateTasks[taskIndex].regexp.test(urlList[i])) | 103 if (candidateTasks[taskIndex].regexp.test(urlList[i])) |
| 104 continue; | 104 continue; |
| 105 | 105 |
| 106 // This task doesn't match this url, remove the task. | 106 // This task doesn't match this url, remove the task. |
| 107 candidateTasks.splice(taskIndex, 1); | 107 candidateTasks.splice(taskIndex, 1); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 callback(candidateTasks); | 111 setTimeout(function() { |
|
rginda
2011/08/26 22:41:03
Test harness didn't exhibit the multiple-task-butt
| |
| 112 callback(candidateTasks); | |
| 113 }, 200); | |
| 112 }, | 114 }, |
| 113 | 115 |
| 114 /** | 116 /** |
| 115 * Executes a task. | 117 * Executes a task. |
| 116 */ | 118 */ |
| 117 executeTask: function(taskId, urlList) { | 119 executeTask: function(taskId, urlList) { |
| 118 console.log('executing task: ' + taskId + ': ' + urlList.length + ' urls'); | 120 console.log('executing task: ' + taskId + ': ' + urlList.length + ' urls'); |
| 119 var parts = taskId.split('|'); | 121 var parts = taskId.split('|'); |
| 120 taskId = parts[parts.length - 1]; | 122 taskId = parts[parts.length - 1]; |
| 121 function createEntry(url) { | 123 function createEntry(url) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 }; | 333 }; |
| 332 | 334 |
| 333 chrome.fileBrowserHandler = { | 335 chrome.fileBrowserHandler = { |
| 334 onExecute: { | 336 onExecute: { |
| 335 listeners_: [], | 337 listeners_: [], |
| 336 addListener: function(listener) { | 338 addListener: function(listener) { |
| 337 chrome.fileBrowserHandler.onExecute.listeners_.push(listener); | 339 chrome.fileBrowserHandler.onExecute.listeners_.push(listener); |
| 338 } | 340 } |
| 339 } | 341 } |
| 340 }; | 342 }; |
| OLD | NEW |