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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 { | 76 { |
77 var index = this._children.indexOf(child); | 77 var index = this._children.indexOf(child); |
78 if (index === -1) { | 78 if (index === -1) { |
79 failure("Failed to remove file: file not found."); | 79 failure("Failed to remove file: file not found."); |
80 return; | 80 return; |
81 } | 81 } |
82 var fullPath = this._fileSystem.fileSystemPath + child.fullPath; | 82 var fullPath = this._fileSystem.fileSystemPath + child.fullPath; |
83 this._children.splice(index, 1); | 83 this._children.splice(index, 1); |
84 delete this._childrenMap[child.name]; | 84 delete this._childrenMap[child.name]; |
85 child.parent = null; | 85 child.parent = null; |
86 InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendH
ostAPI.Events.FileSystemFilesChanged, [fullPath]); | 86 InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendH
ostAPI.Events.FileSystemFilesChanged, {changedPaths: [], removedPaths: [fullPath
], addedPaths: []}); |
87 success(); | 87 success(); |
88 }, | 88 }, |
89 | 89 |
90 mkdir: function(name) | 90 mkdir: function(name) |
91 { | 91 { |
92 var child = new InspectorTest.TestFileSystem.Entry(this._fileSystem, nam
e, true, this); | 92 var child = new InspectorTest.TestFileSystem.Entry(this._fileSystem, nam
e, true, this); |
93 this._childrenMap[name] = child; | 93 this._childrenMap[name] = child; |
94 this._children.push(child); | 94 this._children.push(child); |
95 child.parent = this; | 95 child.parent = this; |
96 return child; | 96 return child; |
97 }, | 97 }, |
98 | 98 |
99 addFile: function(name, content) | 99 addFile: function(name, content) |
100 { | 100 { |
101 var child = new InspectorTest.TestFileSystem.Entry(this._fileSystem, nam
e, false, this); | 101 var child = new InspectorTest.TestFileSystem.Entry(this._fileSystem, nam
e, false, this); |
102 this._childrenMap[name] = child; | 102 this._childrenMap[name] = child; |
103 this._children.push(child); | 103 this._children.push(child); |
104 child.parent = this; | 104 child.parent = this; |
105 child.content = new Blob([content], {type: 'text/plain'}); | 105 child.content = new Blob([content], {type: 'text/plain'}); |
106 return child; | 106 return child; |
107 }, | 107 }, |
108 | 108 |
109 setContent: function(content) | 109 setContent: function(content) |
110 { | 110 { |
111 this.content = new Blob([content], {type: 'text/plain'}); | 111 this.content = new Blob([content], {type: 'text/plain'}); |
112 var fullPath = this._fileSystem.fileSystemPath + this.fullPath; | 112 var fullPath = this._fileSystem.fileSystemPath + this.fullPath; |
113 InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendH
ostAPI.Events.FileSystemFilesChanged, [fullPath]); | 113 InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendH
ostAPI.Events.FileSystemFilesChanged, {changedPaths: [fullPath], removedPaths: [
], addedPaths: []}); |
114 }, | 114 }, |
115 | 115 |
116 createReader: function() | 116 createReader: function() |
117 { | 117 { |
118 return new InspectorTest.TestFileSystem.Reader(this._children); | 118 return new InspectorTest.TestFileSystem.Reader(this._children); |
119 }, | 119 }, |
120 | 120 |
121 createWriter: function(success, failure) | 121 createWriter: function(success, failure) |
122 { | 122 { |
123 success(new InspectorTest.TestFileSystem.Writer(this)); | 123 success(new InspectorTest.TestFileSystem.Writer(this)); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 truncate: function(num) | 207 truncate: function(num) |
208 { | 208 { |
209 this._entry._timestamp += this._modificationTimesDelta; | 209 this._entry._timestamp += this._modificationTimesDelta; |
210 this._entry.content = this._entry.content.slice(0, num); | 210 this._entry.content = this._entry.content.slice(0, num); |
211 if (this.onwriteend) | 211 if (this.onwriteend) |
212 this.onwriteend(); | 212 this.onwriteend(); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 }; | 216 }; |
OLD | NEW |