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 var harness = { | 5 var harness = { |
6 /** | 6 /** |
7 * Kick off the test harness. | 7 * Kick off the test harness. |
8 * | 8 * |
9 * Called by harness.html after the dom has been parsed. | 9 * Called by harness.html after the dom has been parsed. |
10 */ | 10 */ |
11 init: function() { | 11 init: function() { |
12 console.log('Initializing harness...'); | 12 console.log('Initializing harness...'); |
13 | 13 |
14 util.installFileErrorToString(); | 14 util.installFileErrorToString(); |
15 | 15 |
16 var self = this; | 16 var self = this; |
17 | 17 |
18 function onFilesystem(filesystem) { | 18 function onFilesystem(filesystem) { |
19 console.log('Filesystem found.'); | 19 console.log('Filesystem found.'); |
20 self.filesystem = filesystem; | 20 self.filesystem = filesystem; |
21 util.getOrCreateDirectory('/Downloads', function () {}); | 21 util.getOrCreateDirectory(filesystem.root, '/Downloads', function () {}); |
22 util.getOrCreateDirectory('/media', function () {}); | 22 util.getOrCreateDirectory(filesystem.root, '/media', function () {}); |
23 }; | 23 }; |
24 | 24 |
25 window.webkitRequestFileSystem(window.PERSISTENT, 16 * 1024 * 1024, | 25 window.webkitRequestFileSystem(window.PERSISTENT, 16 * 1024 * 1024, |
26 onFilesystem, | 26 onFilesystem, |
27 util.flog('Error initializing filesystem')); | 27 util.flog('Error initializing filesystem')); |
28 | 28 |
29 var paramstr = decodeURIComponent(document.location.search.substr(1)); | 29 var paramstr = decodeURIComponent(document.location.search.substr(1)); |
30 this.params = paramstr ? JSON.parse(paramstr) : {}; | 30 this.params = paramstr ? JSON.parse(paramstr) : {}; |
31 | 31 |
32 var input = document.getElementById('default-path'); | 32 var input = document.getElementById('default-path'); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 function processNextFile() { | 125 function processNextFile() { |
126 if (files.length == 0) { | 126 if (files.length == 0) { |
127 console.log('Import complete: ' + importCount + ' file(s)'); | 127 console.log('Import complete: ' + importCount + ' file(s)'); |
128 return; | 128 return; |
129 } | 129 } |
130 | 130 |
131 currentSrc = files.shift(); | 131 currentSrc = files.shift(); |
132 var destPath = harness.fileManager.currentDirEntry_.fullPath + '/' + | 132 var destPath = harness.fileManager.currentDirEntry_.fullPath + '/' + |
133 currentSrc.name.replace(/\^\^/g, '/'); | 133 currentSrc.name.replace(/\^\^/g, '/'); |
134 util.getOrCreateFile(destPath, onFileFound, | 134 util.getOrCreateFile(self.filesystem.root, destPath, onFileFound, |
135 util.flog('Error finding path: ' + destPath)); | 135 util.flog('Error finding path: ' + destPath)); |
136 } | 136 } |
137 | 137 |
138 console.log('Start import: ' + files.length + ' file(s)'); | 138 console.log('Start import: ' + files.length + ' file(s)'); |
139 processNextFile(); | 139 processNextFile(); |
140 }, | 140 }, |
141 }; | 141 }; |
OLD | NEW |