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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/Connections.js

Issue 2837083003: DevTools: create test infrastructure so devtools drives the test (Closed)
Patch Set: all Created 3 years, 6 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 * @implements {Protocol.InspectorBackend.Connection} 5 * @implements {Protocol.InspectorBackend.Connection}
6 * @unrestricted 6 * @unrestricted
7 */ 7 */
8 SDK.MainConnection = class { 8 SDK.MainConnection = class {
9 /** 9 /**
10 * @param {!Protocol.InspectorBackend.Connection.Params} params 10 * @param {!Protocol.InspectorBackend.Connection.Params} params
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 * @param {string} message 204 * @param {string} message
205 */ 205 */
206 sendMessage(message) { 206 sendMessage(message) {
207 setTimeout(this._respondWithError.bind(this, message), 0); 207 setTimeout(this._respondWithError.bind(this, message), 0);
208 } 208 }
209 209
210 /** 210 /**
211 * @param {string} message 211 * @param {string} message
212 */ 212 */
213 _respondWithError(message) { 213 _respondWithError(message) {
214 if (Host.isUnderTest())
dgozman 2017/06/19 22:55:52 Why this?
chenwilliam 2017/06/19 23:48:18 I accidentally ran unit tests w/ integration test
215 return;
216
214 var messageObject = JSON.parse(message); 217 var messageObject = JSON.parse(message);
215 var error = { 218 var error = {
216 message: 'This is a stub connection, can\'t dispatch message.', 219 message: 'This is a stub connection, can\'t dispatch message.',
217 code: Protocol.InspectorBackend.DevToolsStubErrorCode, 220 code: Protocol.InspectorBackend.DevToolsStubErrorCode,
218 data: messageObject 221 data: messageObject
219 }; 222 };
220 this._onMessage.call(null, {id: messageObject.id, error: error}); 223 this._onMessage.call(null, {id: messageObject.id, error: error});
221 } 224 }
222 225
223 /** 226 /**
224 * @override 227 * @override
225 * @return {!Promise} 228 * @return {!Promise}
226 */ 229 */
227 disconnect() { 230 disconnect() {
228 this._onDisconnect.call(null, 'force disconnect'); 231 this._onDisconnect.call(null, 'force disconnect');
229 this._onDisconnect = null; 232 this._onDisconnect = null;
230 this._onMessage = null; 233 this._onMessage = null;
231 return Promise.resolve(); 234 return Promise.resolve();
232 } 235 }
233 }; 236 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698