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 }; | 21 }; |
22 | 22 |
23 window.requestFileSystem(window.PERSISTENT, 16 * 1024 * 1024, | 23 window.webkitRequestFileSystem(window.PERSISTENT, 16 * 1024 * 1024, |
24 onFilesystem, | 24 onFilesystem, |
25 util.flog('Error initializing filesystem')); | 25 util.flog('Error initializing filesystem')); |
26 | 26 |
27 var paramstr = decodeURIComponent(document.location.search.substr(1)); | 27 var paramstr = decodeURIComponent(document.location.search.substr(1)); |
28 this.params = paramstr ? JSON.parse(paramstr) : {}; | 28 this.params = paramstr ? JSON.parse(paramstr) : {}; |
29 | 29 |
30 var input = document.getElementById('default-path'); | 30 var input = document.getElementById('default-path'); |
31 input.value = this.params.defaultPath || ''; | 31 input.value = this.params.defaultPath || ''; |
32 input.addEventListener('keyup', this.onInputKeyUp.bind(this)); | 32 input.addEventListener('keyup', this.onInputKeyUp.bind(this)); |
33 | 33 |
34 var iframe = document.getElementById('dialog'); | 34 var iframe = document.getElementById('dialog'); |
35 iframe.setAttribute('src', 'main.html' + document.location.search); | 35 iframe.setAttribute('src', 'main.html' + document.location.search); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 name = names.shift(); | 179 name = names.shift(); |
180 } while (!name || name == '.'); | 180 } while (!name || name == '.'); |
181 | 181 |
182 dir.getDirectory(name, { create: true }, getOrCreateNextName, | 182 dir.getDirectory(name, { create: true }, getOrCreateNextName, |
183 errorCallback); | 183 errorCallback); |
184 } | 184 } |
185 | 185 |
186 getOrCreateNextName(this.filesystem.root); | 186 getOrCreateNextName(this.filesystem.root); |
187 } | 187 } |
188 }; | 188 }; |
OLD | NEW |