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

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

Issue 2533483002: [DevTools] Typed events and event listeners. (Closed)
Patch Set: Created 4 years 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 Persistence.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 = Workspace.workspace.uiSourceCodes(); 20 var uiSourceCodes = Workspace.workspace.uiSourceCodes();
21 for (var uiSourceCode of uiSourceCodes) { 21 for (var uiSourceCode of uiSourceCodes) {
22 var binding = Persistence.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 Persistence.persistence.addEventListener(Persistence.Persistence.Events.Bind ingCreated, onBindingCreated); 30 Persistence.persistence.addEventListener(Persistence.Persistence.BindingChan gedEvent, onBindingChanged);
31 return promise; 31 return promise;
32 32
33 function onBindingCreated(event) 33 function onBindingChanged(event)
34 { 34 {
35 var binding = event.data; 35 if (!event.created)
36 if (binding.network.name() !== fileName && binding.fileSystem.name() !== fileName)
37 return; 36 return;
38 Persistence.persistence.removeEventListener(Persistence.Persistence.Even ts.BindingCreated, onBindingCreated); 37 if (event.binding.network.name() !== fileName && event.binding.fileSyste m.name() !== fileName)
39 fulfill(binding); 38 return;
39 Persistence.persistence.removeEventListener(Persistence.Persistence.Bind ingChangedEvent, onBindingChanged);
40 fulfill(event.binding);
40 } 41 }
41 } 42 }
42 43
43 InspectorTest.waitForUISourceCode = function(name, projectType) 44 InspectorTest.waitForUISourceCode = function(name, projectType)
44 { 45 {
45 var uiSourceCodes = Workspace.workspace.uiSourceCodes(); 46 var uiSourceCodes = Workspace.workspace.uiSourceCodes();
46 var uiSourceCode = uiSourceCodes.find(filterCode); 47 var uiSourceCode = uiSourceCodes.find(filterCode);
47 if (uiSourceCode) 48 if (uiSourceCode)
48 return Promise.resolve(uiSourceCode); 49 return Promise.resolve(uiSourceCode);
49 50
(...skipping 16 matching lines...) Expand all
66 return uiSourceCode.name() === name && uiSourceCode.project().type() === projectType; 67 return uiSourceCode.name() === name && uiSourceCode.project().type() === projectType;
67 } 68 }
68 } 69 }
69 70
70 InspectorTest.addFooJSFile = function(fs) 71 InspectorTest.addFooJSFile = function(fs)
71 { 72 {
72 return fs.root.mkdir("inspector").mkdir("persistence").mkdir("resources").ad dFile("foo.js", "\n\nwindow.foo = ()=>'foo';"); 73 return fs.root.mkdir("inspector").mkdir("persistence").mkdir("resources").ad dFile("foo.js", "\n\nwindow.foo = ()=>'foo';");
73 } 74 }
74 75
75 } 76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698