OLD | NEW |
1 var initialize_IsolatedFileSystemTest = function() { | 1 var initialize_IsolatedFileSystemTest = function() { |
2 | 2 |
3 InspectorTest.createIsolatedFileSystemManager = function(workspace) | 3 InspectorTest.createIsolatedFileSystemManager = function(workspace) |
4 { | 4 { |
5 var normalizePath = WebInspector.IsolatedFileSystem.normalizePath | 5 var normalizePath = WebInspector.IsolatedFileSystem.normalizePath |
6 WebInspector.IsolatedFileSystem = MockIsolatedFileSystem; | 6 WebInspector.IsolatedFileSystem = MockIsolatedFileSystem; |
7 WebInspector.IsolatedFileSystem.normalizePath = normalizePath; | 7 WebInspector.IsolatedFileSystem.normalizePath = normalizePath; |
8 | 8 |
9 var manager = new MockIsolatedFileSystemManager(); | 9 var manager = new MockIsolatedFileSystemManager(); |
10 manager.fileSystemMapping = InspectorTest.testFileSystemMapping; | 10 manager.fileSystemMapping = InspectorTest.testFileSystemMapping; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 renameFile: function(filePath, newName, callback) | 64 renameFile: function(filePath, newName, callback) |
65 { | 65 { |
66 callback(true, newName); | 66 callback(true, newName); |
67 }, | 67 }, |
68 | 68 |
69 _innerRequestFilesRecursive: function() | 69 _innerRequestFilesRecursive: function() |
70 { | 70 { |
71 if (!this._callback) | 71 if (!this._callback) |
72 return; | 72 return; |
73 var files = Object.keys(this._files); | 73 var files = Object.keys(this._files); |
74 for (var i = 0; i < files.length; ++i) { | 74 for (var i = 0; i < files.length; ++i) |
75 var isExcluded = false; | |
76 for (var j = 0; j < files[i].length; ++j) { | |
77 if (files[i][j] === "/") { | |
78 if (InspectorTest.testExcludedFolderManager.isFileExcluded(t
his._path, files[i].substr(0, j + 1))) | |
79 isExcluded = true; | |
80 } | |
81 } | |
82 if (isExcluded) | |
83 continue; | |
84 this._callback(files[i].substr(1)); | 75 this._callback(files[i].substr(1)); |
85 } | |
86 delete this._callback; | 76 delete this._callback; |
87 }, | 77 }, |
88 | 78 |
89 _addFiles: function(files) | 79 _addFiles: function(files) |
90 { | 80 { |
91 this._files = files; | 81 this._files = files; |
92 this._modificationTimestamps = {}; | 82 this._modificationTimestamps = {}; |
93 var files = Object.keys(this._files); | 83 var files = Object.keys(this._files); |
94 for (var i = 0; i < files.length; ++i) | 84 for (var i = 0; i < files.length; ++i) |
95 this._modificationTimestamps[files[i]] = this.originalTimestamp; | 85 this._modificationTimestamps[files[i]] = this.originalTimestamp; |
(...skipping 25 matching lines...) Expand all Loading... |
121 delete this._fileSystems[path]; | 111 delete this._fileSystems[path]; |
122 this.fileSystemMapping.removeFileSystem(path); | 112 this.fileSystemMapping.removeFileSystem(path); |
123 this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Eve
nts.FileSystemRemoved, fileSystem); | 113 this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Eve
nts.FileSystemRemoved, fileSystem); |
124 }, | 114 }, |
125 | 115 |
126 mapping: function() | 116 mapping: function() |
127 { | 117 { |
128 return this.fileSystemMapping; | 118 return this.fileSystemMapping; |
129 }, | 119 }, |
130 | 120 |
131 excludedFolderManager: function() | |
132 { | |
133 return InspectorTest.testExcludedFolderManager; | |
134 }, | |
135 | |
136 __proto__: WebInspector.Object.prototype | 121 __proto__: WebInspector.Object.prototype |
137 } | 122 } |
138 | 123 |
139 InspectorTest.addMockFileSystem = function(path) | 124 InspectorTest.addMockFileSystem = function(path) |
140 { | 125 { |
141 var fileSystem = { fileSystemName: "", rootURL: "", fileSystemPath: path }; | 126 var fileSystem = { fileSystemName: "", rootURL: "", fileSystemPath: path }; |
142 WebInspector.isolatedFileSystemManager._onFileSystemAdded({data: {fileSystem
: fileSystem}}); | 127 WebInspector.isolatedFileSystemManager._onFileSystemAdded({data: {fileSystem
: fileSystem}}); |
143 return MockIsolatedFileSystem._isolatedFileSystemMocks[path]; | 128 return MockIsolatedFileSystem._isolatedFileSystemMocks[path]; |
144 } | 129 } |
145 | 130 |
146 InspectorTest.addFilesToMockFileSystem = function(path, files) | 131 InspectorTest.addFilesToMockFileSystem = function(path, files) |
147 { | 132 { |
148 MockIsolatedFileSystem._isolatedFileSystemMocks[path]._addFiles(files); | 133 MockIsolatedFileSystem._isolatedFileSystemMocks[path]._addFiles(files); |
149 } | 134 } |
150 | 135 |
151 InspectorFrontendHost.isolatedFileSystem = function(name, url) | 136 InspectorFrontendHost.isolatedFileSystem = function(name) |
152 { | 137 { |
153 return InspectorTest.TestFileSystem._instances[name]; | 138 return InspectorTest.TestFileSystem._instances[name]; |
154 } | 139 } |
155 | 140 |
156 InspectorTest.TestFileSystem = function(fileSystemPath) | 141 InspectorTest.TestFileSystem = function(fileSystemPath) |
157 { | 142 { |
158 this.root = new InspectorTest.TestFileSystem.Entry("", true); | 143 this.root = new InspectorTest.TestFileSystem.Entry("", true); |
159 this.fileSystemPath = fileSystemPath; | 144 this.fileSystemPath = fileSystemPath; |
160 } | 145 } |
161 | 146 |
162 InspectorTest.TestFileSystem._instances = {}; | 147 InspectorTest.TestFileSystem._instances = {}; |
163 | 148 |
164 InspectorTest.TestFileSystem.prototype = { | 149 InspectorTest.TestFileSystem.prototype = { |
165 reportCreated: function() | 150 reportCreated: function() |
166 { | 151 { |
167 WebInspector.isolatedFileSystemManager._loaded = true; | |
168 InspectorTest.TestFileSystem._instances[this.fileSystemPath] = this; | 152 InspectorTest.TestFileSystem._instances[this.fileSystemPath] = this; |
169 InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendH
ostAPI.Events.FileSystemAdded, { | 153 InspectorFrontendHost.events.dispatchEventToListeners(InspectorFrontendH
ostAPI.Events.FileSystemAdded, { |
170 fileSystem: { fileSystemPath: this.fileSystemPath, | 154 fileSystem: { fileSystemPath: this.fileSystemPath, |
171 fileSystemName: this.fileSystemPath } | 155 fileSystemName: this.fileSystemPath } |
172 }); | 156 }); |
173 }, | 157 }, |
174 | 158 |
175 removeFileSystem: function() | 159 removeFileSystem: function() |
176 { | 160 { |
177 delete InspectorTest.TestFileSystem._instances[this.fileSystemPath]; | 161 delete InspectorTest.TestFileSystem._instances[this.fileSystemPath]; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 truncate: function(num) | 276 truncate: function(num) |
293 { | 277 { |
294 this._entry._timestamp += this._modificationTimesDelta; | 278 this._entry._timestamp += this._modificationTimesDelta; |
295 this._entry.content = this._entry.content.slice(0, num); | 279 this._entry.content = this._entry.content.slice(0, num); |
296 if (this.onwriteend) | 280 if (this.onwriteend) |
297 this.onwriteend(); | 281 this.onwriteend(); |
298 } | 282 } |
299 } | 283 } |
300 | 284 |
301 }; | 285 }; |
OLD | NEW |