| OLD | NEW |
| 1 var initialize_IsolatedFileSystemTest = function() { | 1 var initialize_IsolatedFileSystemTest = function() { |
| 2 | 2 |
| 3 InspectorFrontendHost.isolatedFileSystem = function(name) | 3 InspectorFrontendHost.isolatedFileSystem = function(name) |
| 4 { | 4 { |
| 5 return InspectorTest.TestFileSystem._instances[name]; | 5 return InspectorTest.TestFileSystem._instances[name]; |
| 6 } | 6 } |
| 7 | 7 |
| 8 InspectorTest.TestFileSystem = function(fileSystemPath) | 8 InspectorTest.TestFileSystem = function(fileSystemPath) |
| 9 { | 9 { |
| 10 this.root = new InspectorTest.TestFileSystem.Entry(this, "", true, null); | 10 this.root = new InspectorTest.TestFileSystem.Entry(this, "", true, null); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 { | 100 { |
| 101 var index = this._children.indexOf(child); | 101 var index = this._children.indexOf(child); |
| 102 if (index === -1) { | 102 if (index === -1) { |
| 103 failure("Failed to remove file: file not found."); | 103 failure("Failed to remove file: file not found."); |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 var fullPath = this._fileSystem.fileSystemPath + child.fullPath; | 106 var fullPath = this._fileSystem.fileSystemPath + child.fullPath; |
| 107 this._children.splice(index, 1); | 107 this._children.splice(index, 1); |
| 108 delete this._childrenMap[child.name]; | 108 delete this._childrenMap[child.name]; |
| 109 child.parent = null; | 109 child.parent = null; |
| 110 InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendH
ostAPI.Events.FileSystemFilesChanged, [fullPath]); | 110 InspectorFrontendHost.events.dispatchEventToListeners( |
| 111 InspectorFrontendHostAPI.Events.FileSystemFilesChangedAddedRemoved, |
| 112 {changed: [], added: [], removed: [fullPath]}); |
| 111 success(); | 113 success(); |
| 112 }, | 114 }, |
| 113 | 115 |
| 114 mkdir: function(name) | 116 mkdir: function(name) |
| 115 { | 117 { |
| 116 var child = new InspectorTest.TestFileSystem.Entry(this._fileSystem, nam
e, true, this); | 118 var child = new InspectorTest.TestFileSystem.Entry(this._fileSystem, nam
e, true, this); |
| 117 this._childrenMap[name] = child; | 119 this._childrenMap[name] = child; |
| 118 this._children.push(child); | 120 this._children.push(child); |
| 119 child.parent = this; | 121 child.parent = this; |
| 120 return child; | 122 return child; |
| 121 }, | 123 }, |
| 122 | 124 |
| 123 addFile: function(name, content) | 125 addFile: function(name, content) |
| 124 { | 126 { |
| 125 var child = new InspectorTest.TestFileSystem.Entry(this._fileSystem, nam
e, false, this); | 127 var child = new InspectorTest.TestFileSystem.Entry(this._fileSystem, nam
e, false, this); |
| 126 this._childrenMap[name] = child; | 128 this._childrenMap[name] = child; |
| 127 this._children.push(child); | 129 this._children.push(child); |
| 128 child.parent = this; | 130 child.parent = this; |
| 129 child.content = new Blob([content], {type: 'text/plain'}); | 131 child.content = new Blob([content], {type: 'text/plain'}); |
| 130 var fullPath = this._fileSystem.fileSystemPath + child.fullPath; | 132 var fullPath = this._fileSystem.fileSystemPath + child.fullPath; |
| 131 InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendH
ostAPI.Events.FileSystemFilesChanged, [fullPath]); | 133 InspectorFrontendHost.events.dispatchEventToListeners( |
| 134 InspectorFrontendHostAPI.Events.FileSystemFilesChangedAddedRemoved, |
| 135 {changed: [], added: [fullPath], removed: []}); |
| 132 return child; | 136 return child; |
| 133 }, | 137 }, |
| 134 | 138 |
| 135 setContent: function(content) | 139 setContent: function(content) |
| 136 { | 140 { |
| 137 this.content = new Blob([content], {type: 'text/plain'}); | 141 this.content = new Blob([content], {type: 'text/plain'}); |
| 138 this._timestamp += 1000; | 142 this._timestamp += 1000; |
| 139 var fullPath = this._fileSystem.fileSystemPath + this.fullPath; | 143 var fullPath = this._fileSystem.fileSystemPath + this.fullPath; |
| 140 InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendH
ostAPI.Events.FileSystemFilesChanged, [fullPath]); | 144 InspectorFrontendHost.events.dispatchEventToListeners( |
| 145 InspectorFrontendHostAPI.Events.FileSystemFilesChangedAddedRemoved, |
| 146 {changed: [fullPath], added: [], removed: []}); |
| 141 }, | 147 }, |
| 142 | 148 |
| 143 createReader: function() | 149 createReader: function() |
| 144 { | 150 { |
| 145 return new InspectorTest.TestFileSystem.Reader(this._children); | 151 return new InspectorTest.TestFileSystem.Reader(this._children); |
| 146 }, | 152 }, |
| 147 | 153 |
| 148 createWriter: function(success, failure) | 154 createWriter: function(success, failure) |
| 149 { | 155 { |
| 150 success(new InspectorTest.TestFileSystem.Writer(this)); | 156 success(new InspectorTest.TestFileSystem.Writer(this)); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 truncate: function(num) | 240 truncate: function(num) |
| 235 { | 241 { |
| 236 this._entry._timestamp += this._modificationTimesDelta; | 242 this._entry._timestamp += this._modificationTimesDelta; |
| 237 this._entry.content = this._entry.content.slice(0, num); | 243 this._entry.content = this._entry.content.slice(0, num); |
| 238 if (this.onwriteend) | 244 if (this.onwriteend) |
| 239 this.onwriteend(); | 245 this.onwriteend(); |
| 240 } | 246 } |
| 241 } | 247 } |
| 242 | 248 |
| 243 }; | 249 }; |
| OLD | NEW |