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

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

Issue 2208963002: [DevTools] Removed InspectorTest.invokeFunctionInPageAsync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-promise-from-other-tests
Patch Set: a Created 4 years, 4 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var evalCallbackCallId = 3; 5 var evalCallbackCallId = 3;
6 6
7 initialize_tracingHarness = function() 7 initialize_tracingHarness = function()
8 { 8 {
9 9
10 InspectorTest.startTracing = function(callback) 10 InspectorTest.startTracing = function(callback)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 throw new Error("Couldn't find event " + name + " / " + ph + "\n\n in " + JS ON.stringify(InspectorTest.devtoolsEvents, null, 2)); 120 throw new Error("Couldn't find event " + name + " / " + ph + "\n\n in " + JS ON.stringify(InspectorTest.devtoolsEvents, null, 2));
121 } 121 }
122 122
123 InspectorTest.invokeAsyncWithTracing = function(functionName, callback) 123 InspectorTest.invokeAsyncWithTracing = function(functionName, callback)
124 { 124 {
125 InspectorTest.startTracing(onStart); 125 InspectorTest.startTracing(onStart);
126 126
127 function onStart() 127 function onStart()
128 { 128 {
129 InspectorTest.invokePageFunctionAsync(functionName, done); 129 InspectorTest.evaluateInPageAsync(functionName + "()").then((data) => In spectorTest.stopTracing((devtoolsEvents) => callback(devtoolsEvents, data)));
130 }
131
132 function done()
133 {
134 InspectorTest.stopTracing(callback);
135 } 130 }
136 } 131 }
137 132
138 InspectorTest._lastEvalId = 0;
139 InspectorTest._pendingEvalRequests = {};
140
141 InspectorTest.invokePageFunctionAsync = function(functionName, callback)
142 {
143 var id = ++InspectorTest._lastEvalId;
144 InspectorTest._pendingEvalRequests[id] = callback;
145 var asyncEvalWrapper = function(callId, functionName)
146 {
147 function evalCallback(result)
148 {
149 evaluateInFrontend("InspectorTest.didInvokePageFunctionAsync(" + cal lId + ", " + JSON.stringify(result) + ");");
150 }
151 eval(functionName + "(" + evalCallback + ")");
152 }
153 InspectorTest.evaluateInPage("(" + asyncEvalWrapper.toString() + ")(" + id + ", unescape('" + escape(functionName) + "'))", function() { });
154 } 133 }
155
156 InspectorTest.didInvokePageFunctionAsync = function(callId, value)
157 {
158 var callback = InspectorTest._pendingEvalRequests[callId];
159
160 if (!callback) {
161 InspectorTest.addResult("Missing callback for async eval " + callId + ", perhaps callback invoked twice?");
162 return;
163 }
164 delete InspectorTest._pendingEvalRequests[callId];
165 callback(value);
166 }
167
168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698