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

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

Issue 2441933002: [DevTools] Refactor connection-related classes. (Closed)
Patch Set: tests.js 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_WorkspaceTest = function() { 1 var initialize_WorkspaceTest = function() {
2 2
3 InspectorTest.createWorkspace = function(ignoreEvents) 3 InspectorTest.createWorkspace = function(ignoreEvents)
4 { 4 {
5 if (InspectorTest.testFileSystemWorkspaceBinding) 5 if (InspectorTest.testFileSystemWorkspaceBinding)
6 InspectorTest.testFileSystemWorkspaceBinding.dispose(); 6 InspectorTest.testFileSystemWorkspaceBinding.dispose();
7 if (InspectorTest.testNetworkMapping) 7 if (InspectorTest.testNetworkMapping)
8 InspectorTest.testNetworkMapping.dispose(); 8 InspectorTest.testNetworkMapping.dispose();
9 WebInspector.fileSystemMapping.resetForTesting(); 9 WebInspector.fileSystemMapping.resetForTesting();
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 InspectorTest._mockTargetId = 1; 36 InspectorTest._mockTargetId = 1;
37 InspectorTest._pageCapabilities = 37 InspectorTest._pageCapabilities =
38 WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.DOM | 38 WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.DOM |
39 WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Log | 39 WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Log |
40 WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Work er; 40 WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Work er;
41 41
42 InspectorTest.createMockTarget = function(id, debuggerModelConstructor, capabili ties) 42 InspectorTest.createMockTarget = function(id, debuggerModelConstructor, capabili ties)
43 { 43 {
44 capabilities = capabilities || InspectorTest._pageCapabilities; 44 capabilities = capabilities || InspectorTest._pageCapabilities;
45 var MockTarget = function(name, connection, callback) 45 var MockTarget = function(name, connectionFactory, callback)
46 { 46 {
47 WebInspector.Target.call(this, InspectorTest.testTargetManager, name, ca pabilities, connection, null, callback); 47 WebInspector.Target.call(this, InspectorTest.testTargetManager, name, ca pabilities, connectionFactory, null, callback);
48 this._inspectedURL = InspectorTest.mainTarget.inspectedURL(); 48 this._inspectedURL = InspectorTest.mainTarget.inspectedURL();
49 this.consoleModel = new WebInspector.ConsoleModel(this); 49 this.consoleModel = new WebInspector.ConsoleModel(this);
50 this.networkManager = new WebInspector.NetworkManager(this); 50 this.networkManager = new WebInspector.NetworkManager(this);
51 this.runtimeModel = new WebInspector.RuntimeModel(this); 51 this.runtimeModel = new WebInspector.RuntimeModel(this);
52 this.securityOriginManager = WebInspector.SecurityOriginManager.fromTarg et(this); 52 this.securityOriginManager = WebInspector.SecurityOriginManager.fromTarg et(this);
53 this.resourceTreeModel = new WebInspector.ResourceTreeModel(this, this.n etworkManager, this.securityOriginManager); 53 this.resourceTreeModel = new WebInspector.ResourceTreeModel(this, this.n etworkManager, this.securityOriginManager);
54 this.resourceTreeModel._cachedResourcesProcessed = true; 54 this.resourceTreeModel._cachedResourcesProcessed = true;
55 this.resourceTreeModel._frameAttached("42", 0); 55 this.resourceTreeModel._frameAttached("42", 0);
56 this.debuggerModel = debuggerModelConstructor ? new debuggerModelConstru ctor(this) : new WebInspector.DebuggerModel(this); 56 this.debuggerModel = debuggerModelConstructor ? new debuggerModelConstru ctor(this) : new WebInspector.DebuggerModel(this);
57 this._modelByConstructor.set(WebInspector.DebuggerModel, this.debuggerMo del); 57 this._modelByConstructor.set(WebInspector.DebuggerModel, this.debuggerMo del);
58 this.domModel = new WebInspector.DOMModel(this); 58 this.domModel = new WebInspector.DOMModel(this);
59 this.cssModel = new WebInspector.CSSModel(this, this.domModel); 59 this.cssModel = new WebInspector.CSSModel(this, this.domModel);
60 } 60 }
61 61
62 MockTarget.prototype = { 62 MockTarget.prototype = {
63 _loadedWithCapabilities: function() 63 _loadedWithCapabilities: function()
64 { 64 {
65 }, 65 },
66 66
67 __proto__: WebInspector.Target.prototype 67 __proto__: WebInspector.Target.prototype
68 } 68 }
69 69
70 var target = new MockTarget("mock-target-" + id, new WebInspector.StubConnec tion()); 70 var target = new MockTarget("mock-target-" + id, (params) => new WebInspecto r.StubConnection(params));
71 InspectorTest.testTargetManager.addTarget(target); 71 InspectorTest.testTargetManager.addTarget(target);
72 return target; 72 return target;
73 } 73 }
74 74
75 InspectorTest.createWorkspaceWithTarget = function(ignoreEvents) 75 InspectorTest.createWorkspaceWithTarget = function(ignoreEvents)
76 { 76 {
77 InspectorTest.createWorkspace(ignoreEvents); 77 InspectorTest.createWorkspace(ignoreEvents);
78 var target = InspectorTest.createMockTarget(InspectorTest._mockTargetId++); 78 var target = InspectorTest.createMockTarget(InspectorTest._mockTargetId++);
79 return target; 79 return target;
80 } 80 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 function uiSourceCodeAdded(event) 189 function uiSourceCodeAdded(event)
190 { 190 {
191 if (event.data.name() === name) { 191 if (event.data.name() === name) {
192 WebInspector.workspace.removeEventListener(WebInspector.Workspace.Ev ents.UISourceCodeAdded, uiSourceCodeAdded); 192 WebInspector.workspace.removeEventListener(WebInspector.Workspace.Ev ents.UISourceCodeAdded, uiSourceCodeAdded);
193 setImmediate(callback); 193 setImmediate(callback);
194 } 194 }
195 } 195 }
196 } 196 }
197 197
198 }; 198 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698