| 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 function MockEventSource() { | 5 function MockEventSource() { |
| 6 this.listeners_ = []; | 6 this.listeners_ = []; |
| 7 } | 7 } |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Add a listener. | 10 * Add a listener. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 for (var key in object) | 43 for (var key in object) |
| 44 if (object.hasOwnProperty(key)) | 44 if (object.hasOwnProperty(key)) |
| 45 clone[key] = object[key]; | 45 clone[key] = object[key]; |
| 46 return clone; | 46 return clone; |
| 47 } | 47 } |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Mock out the chrome.fileBrowserPrivate API for use in the harness. | 50 * Mock out the chrome.fileBrowserPrivate API for use in the harness. |
| 51 */ | 51 */ |
| 52 chrome.fileBrowserPrivate = { | 52 chrome.fileBrowserPrivate = { |
| 53 /** |
| 54 * Change to window.TEMPORARY if you do not insist on persistence. |
| 55 */ |
| 56 FS_TYPE: window.PERSISTENT, |
| 53 | 57 |
| 54 /** | 58 /** |
| 55 * Return a normal HTML5 filesystem api, rather than the real local | 59 * Return a normal HTML5 filesystem api, rather than the real local |
| 56 * filesystem. | 60 * filesystem. |
| 57 * | 61 * |
| 58 * You must start chrome with --allow-file-access-from-files and | 62 * If the test harness is on file: schema you must start chrome with |
| 59 * --unlimited-quota-for-files in order for this to work. | 63 * --allow-file-access-from-files in order for this to work. |
| 60 */ | 64 */ |
| 61 requestLocalFileSystem: function(callback) { | 65 requestLocalFileSystem: function(callback) { |
| 62 window.webkitRequestFileSystem(window.PERSISTENT, 16 * 1024 * 1024, | 66 window.webkitRequestFileSystem(this.FS_TYPE, |
| 63 callback, | 67 16 * 1024 * 1024, callback, util.ferr('Error requesting filesystem')); |
| 64 util.ferr('Error requesting filesystem')); | |
| 65 }, | 68 }, |
| 66 | 69 |
| 67 /** | 70 /** |
| 68 * View multiple files. | 71 * View multiple files. |
| 69 */ | 72 */ |
| 70 viewFiles: function(urls, actionId, callback) { | 73 viewFiles: function(urls, actionId, callback) { |
| 71 var success = true; | 74 var success = true; |
| 72 for (var i = 0; i != urls.length; i++) { | 75 for (var i = 0; i != urls.length; i++) { |
| 73 var url = urls[i]; | 76 var url = urls[i]; |
| 74 if (!url.match(/\.(pdf|txt)$/i)) { | 77 if (!url.match(/\.(pdf|txt)$/i)) { |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 | 840 |
| 838 setWindowHeight: function(height) { | 841 setWindowHeight: function(height) { |
| 839 this.popup_.style.height = height + 'px'; | 842 this.popup_.style.height = height + 'px'; |
| 840 }, | 843 }, |
| 841 | 844 |
| 842 closeWindow: function() { | 845 closeWindow: function() { |
| 843 this.popup_.parentNode.removeChild(this.popup_); | 846 this.popup_.parentNode.removeChild(this.popup_); |
| 844 this.popup_ = null; | 847 this.popup_ = null; |
| 845 } | 848 } |
| 846 }; | 849 }; |
| OLD | NEW |