| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Sends a test message. | 8 * Sends a test message. |
| 9 * @param {Object} message Message to be sent. It is converted into JSON string | 9 * @param {Object} message Message to be sent. It is converted into JSON string |
| 10 * before sending. | 10 * before sending. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 function addEntries(volumeNames, entries, opt_callback) { | 102 function addEntries(volumeNames, entries, opt_callback) { |
| 103 if (volumeNames.length == 0) { | 103 if (volumeNames.length == 0) { |
| 104 callback(true); | 104 callback(true); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 var volumeResultPromises = volumeNames.map(function(volume) { | 107 var volumeResultPromises = volumeNames.map(function(volume) { |
| 108 return sendTestMessage({ | 108 return sendTestMessage({ |
| 109 name: 'addEntries', | 109 name: 'addEntries', |
| 110 volume: volume, | 110 volume: volume, |
| 111 entries: entries | 111 entries: entries |
| 112 }).then(function(result) { | |
| 113 if (result !== "onEntryAdded") | |
| 114 return Promise.reject('Failed to add entries to ' + volume + '.'); | |
| 115 }); | 112 }); |
| 116 }); | 113 }); |
| 117 var resultPromise = Promise.all(volumeResultPromises); | 114 var resultPromise = Promise.all(volumeResultPromises); |
| 118 if (opt_callback) { | 115 if (opt_callback) { |
| 119 resultPromise.then(opt_callback.bind(null, true), | 116 resultPromise.then(opt_callback.bind(null, true), |
| 120 opt_callback.bind(null, false)); | 117 opt_callback.bind(null, false)); |
| 121 } | 118 } |
| 122 return resultPromise; | 119 return resultPromise; |
| 123 }; | 120 }; |
| 124 | 121 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 directoryF: new TestEntryInfo( | 283 directoryF: new TestEntryInfo( |
| 287 EntryType.DIRECTORY, null, 'D/E/F', | 284 EntryType.DIRECTORY, null, 'D/E/F', |
| 288 null, SharedOption.NONE, 'Jan 1, 2000, 1:00 AM', | 285 null, SharedOption.NONE, 'Jan 1, 2000, 1:00 AM', |
| 289 'F', '--', 'Folder'), | 286 'F', '--', 'Folder'), |
| 290 | 287 |
| 291 zipArchive: new TestEntryInfo( | 288 zipArchive: new TestEntryInfo( |
| 292 EntryType.FILE, 'archive.zip', 'archive.zip', | 289 EntryType.FILE, 'archive.zip', 'archive.zip', |
| 293 'application/x-zip', SharedOption.NONE, 'Jan 1, 2014, 1:00 AM', | 290 'application/x-zip', SharedOption.NONE, 'Jan 1, 2014, 1:00 AM', |
| 294 'archive.zip', '533 bytes', 'Zip archive') | 291 'archive.zip', '533 bytes', 'Zip archive') |
| 295 }; | 292 }; |
| OLD | NEW |