Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-test.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 var initialize_PersistenceTest = function() { 1 var initialize_PersistenceTest = function() {
2 2
3 InspectorTest.preloadModule("persistence"); 3 InspectorTest.preloadModule("persistence");
4 InspectorTest.preloadModule("sources"); 4 InspectorTest.preloadModule("sources");
5 5
6 WebInspector.PersistenceBinding.prototype.toString = function() 6 Persistence.PersistenceBinding.prototype.toString = function()
7 { 7 {
8 var lines = [ 8 var lines = [
9 "{", 9 "{",
10 " network: " + this.network.url(), 10 " network: " + this.network.url(),
11 " fileSystem: " + this.fileSystem.url(), 11 " fileSystem: " + this.fileSystem.url(),
12 " exactMatch: " + this.exactMatch, 12 " exactMatch: " + this.exactMatch,
13 "}" 13 "}"
14 ]; 14 ];
15 return lines.join("\n"); 15 return lines.join("\n");
16 } 16 }
17 17
18 InspectorTest.waitForBinding = function(fileName) 18 InspectorTest.waitForBinding = function(fileName)
19 { 19 {
20 var uiSourceCodes = WebInspector.workspace.uiSourceCodes(); 20 var uiSourceCodes = Workspace.workspace.uiSourceCodes();
21 for (var uiSourceCode of uiSourceCodes) { 21 for (var uiSourceCode of uiSourceCodes) {
22 var binding = WebInspector.persistence.binding(uiSourceCode); 22 var binding = Persistence.persistence.binding(uiSourceCode);
23 if (!binding) 23 if (!binding)
24 continue; 24 continue;
25 if (uiSourceCode.name() === fileName) 25 if (uiSourceCode.name() === fileName)
26 return Promise.resolve(binding); 26 return Promise.resolve(binding);
27 } 27 }
28 var fulfill; 28 var fulfill;
29 var promise = new Promise(x => fulfill = x); 29 var promise = new Promise(x => fulfill = x);
30 WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.Bi ndingCreated, onBindingCreated); 30 Persistence.persistence.addEventListener(Persistence.Persistence.Events.Bind ingCreated, onBindingCreated);
31 return promise; 31 return promise;
32 32
33 function onBindingCreated(event) 33 function onBindingCreated(event)
34 { 34 {
35 var binding = event.data; 35 var binding = event.data;
36 if (binding.network.name() !== fileName && binding.fileSystem.name() !== fileName) 36 if (binding.network.name() !== fileName && binding.fileSystem.name() !== fileName)
37 return; 37 return;
38 WebInspector.persistence.removeEventListener(WebInspector.Persistence.Ev ents.BindingCreated, onBindingCreated); 38 Persistence.persistence.removeEventListener(Persistence.Persistence.Even ts.BindingCreated, onBindingCreated);
39 fulfill(binding); 39 fulfill(binding);
40 } 40 }
41 } 41 }
42 42
43 InspectorTest.waitForUISourceCode = function(name, projectType) 43 InspectorTest.waitForUISourceCode = function(name, projectType)
44 { 44 {
45 var uiSourceCodes = WebInspector.workspace.uiSourceCodes(); 45 var uiSourceCodes = Workspace.workspace.uiSourceCodes();
46 var uiSourceCode = uiSourceCodes.find(filterCode); 46 var uiSourceCode = uiSourceCodes.find(filterCode);
47 if (uiSourceCode) 47 if (uiSourceCode)
48 return Promise.resolve(uiSourceCode); 48 return Promise.resolve(uiSourceCode);
49 49
50 var fulfill; 50 var fulfill;
51 var promise = new Promise(x => fulfill = x); 51 var promise = new Promise(x => fulfill = x);
52 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISour ceCodeAdded, onUISourceCode); 52 Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCode Added, onUISourceCode);
53 return promise; 53 return promise;
54 54
55 function onUISourceCode(event) 55 function onUISourceCode(event)
56 { 56 {
57 var uiSourceCode = event.data; 57 var uiSourceCode = event.data;
58 if (!filterCode(uiSourceCode)) 58 if (!filterCode(uiSourceCode))
59 return; 59 return;
60 WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events .UISourceCodeAdded, onUISourceCode); 60 Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISou rceCodeAdded, onUISourceCode);
61 fulfill(uiSourceCode); 61 fulfill(uiSourceCode);
62 } 62 }
63 63
64 function filterCode(uiSourceCode) 64 function filterCode(uiSourceCode)
65 { 65 {
66 return uiSourceCode.name() === name && uiSourceCode.project().type() === projectType; 66 return uiSourceCode.name() === name && uiSourceCode.project().type() === projectType;
67 } 67 }
68 } 68 }
69 69
70 InspectorTest.addFooJSFile = function(fs) 70 InspectorTest.addFooJSFile = function(fs)
71 { 71 {
72 return fs.root.mkdir("inspector").mkdir("persistence").mkdir("resources").ad dFile("foo.js", "\n\nwindow.foo = ()=>'foo';"); 72 return fs.root.mkdir("inspector").mkdir("persistence").mkdir("resources").ad dFile("foo.js", "\n\nwindow.foo = ()=>'foo';");
73 } 73 }
74 74
75 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698