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

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

Issue 2349343002: DevTools: introduce persistence/ module (Closed)
Patch Set: DevTools: add persistence/ module Created 4 years, 3 months 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
(Empty)
1 var initialize_PersistenceTest = function() {
2
3 InspectorTest.preloadModule("persistence");
4 InspectorTest.preloadModule("sources");
5
6 WebInspector.PersistenceBinding.prototype.toString = function()
7 {
8 var lines = [
9 "{",
10 " network: " + this.network.url(),
11 " persistent: " + this.persistent.url(),
12 "}"
13 ];
14 return lines.join("\n");
15 }
16
17 InspectorTest.waitForBinding = function(fileName, callback)
18 {
19 var bindings = WebInspector.persistence._bindings.valuesArray();
20 for (var binding of bindings) {
21 if (binding.network.name() === fileName || binding.persistent.name() === fileName) {
22 callback(binding);
23 return;
24 }
25 }
26 WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.Bi ndingCreated, onBindingCreated);
27
28 function onBindingCreated(event)
29 {
30 var binding = event.data;
31 if (binding.network.name() !== fileName && binding.persistent.name() !== fileName)
32 return;
33 WebInspector.persistence.removeEventListener(WebInspector.Persistence.Ev ents.BindingCreated, onBindingCreated);
34 callback(binding);
35 }
36 }
37
38 InspectorTest.waitForUISourceCode = function(name, projectType)
39 {
40 var uiSourceCodes = WebInspector.workspace.uiSourceCodes();
41 var uiSourceCode = uiSourceCodes.find(filterCode);
42 if (uiSourceCode)
43 return Promise.resolve(uiSourceCode);
44
45 var fulfill;
46 var promise = new Promise(x => fulfill = x);
47 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISour ceCodeAdded, onUISourceCode);
48 return promise;
49
50 function onUISourceCode(event)
51 {
52 var uiSourceCode = event.data;
53 if (!filterCode(uiSourceCode))
54 return;
55 WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events .UISourceCodeAdded, onUISourceCode);
56 fulfill(uiSourceCode);
57 }
58
59 function filterCode(uiSourceCode)
60 {
61 return uiSourceCode.name() === name && uiSourceCode.project().type() === projectType;
62 }
63 }
64
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698