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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 Runtime.experiments.setDefaultExperiments([ 142 Runtime.experiments.setDefaultExperiments([
143 'continueToLocationMarkers', 'autoAttachToCrossProcessSubframes', 'objectP reviews', 'audits2', 143 'continueToLocationMarkers', 'autoAttachToCrossProcessSubframes', 'objectP reviews', 'audits2',
144 'networkGroupingRequests', 'timelineColorByProduct' 144 'networkGroupingRequests', 'timelineColorByProduct'
145 ]); 145 ]);
146 } 146 }
147 147
148 /** 148 /**
149 * @suppressGlobalPropertiesCheck 149 * @suppressGlobalPropertiesCheck
150 */ 150 */
151 _createAppUI() { 151 _createAppUI() {
152 console.time('Main._createAppUI'); 152 Main.time('Main._createAppUI');
153 153
154 UI.viewManager = new UI.ViewManager(); 154 UI.viewManager = new UI.ViewManager();
155 155
156 // Request filesystems early, we won't create connections until callback is fired. Things will happen in parallel. 156 // Request filesystems early, we won't create connections until callback is fired. Things will happen in parallel.
157 Persistence.isolatedFileSystemManager = new Persistence.IsolatedFileSystemMa nager(); 157 Persistence.isolatedFileSystemManager = new Persistence.IsolatedFileSystemMa nager();
158 158
159 var themeSetting = Common.settings.createSetting('uiTheme', 'default'); 159 var themeSetting = Common.settings.createSetting('uiTheme', 'default');
160 UI.initializeUIUtils(document, themeSetting); 160 UI.initializeUIUtils(document, themeSetting);
161 themeSetting.addChangeListener(Components.reload.bind(Components)); 161 themeSetting.addChangeListener(Components.reload.bind(Components));
162 162
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 new Main.SourcesPanelIndicator(); 211 new Main.SourcesPanelIndicator();
212 new Main.BackendSettingsSync(); 212 new Main.BackendSettingsSync();
213 213
214 UI.actionRegistry = new UI.ActionRegistry(); 214 UI.actionRegistry = new UI.ActionRegistry();
215 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document); 215 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document);
216 UI.ShortcutsScreen.registerShortcuts(); 216 UI.ShortcutsScreen.registerShortcuts();
217 this._registerForwardedShortcuts(); 217 this._registerForwardedShortcuts();
218 this._registerMessageSinkListener(); 218 this._registerMessageSinkListener();
219 219
220 self.runtime.extension(Common.AppProvider).instance().then(this._showAppUI.b ind(this)); 220 self.runtime.extension(Common.AppProvider).instance().then(this._showAppUI.b ind(this));
221 console.timeEnd('Main._createAppUI'); 221 Main.timeEnd('Main._createAppUI');
222 } 222 }
223 223
224 /** 224 /**
225 * @param {!Object} appProvider 225 * @param {!Object} appProvider
226 * @suppressGlobalPropertiesCheck 226 * @suppressGlobalPropertiesCheck
227 */ 227 */
228 _showAppUI(appProvider) { 228 _showAppUI(appProvider) {
229 console.time('Main._showAppUI'); 229 Main.time('Main._showAppUI');
230 var app = /** @type {!Common.AppProvider} */ (appProvider).createApp(); 230 var app = /** @type {!Common.AppProvider} */ (appProvider).createApp();
231 // It is important to kick controller lifetime after apps are instantiated. 231 // It is important to kick controller lifetime after apps are instantiated.
232 Components.dockController.initialize(); 232 Components.dockController.initialize();
233 app.presentUI(document); 233 app.presentUI(document);
234 234
235 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme nt-search'); 235 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme nt-search');
236 // TODO: we should not access actions from other modules. 236 // TODO: we should not access actions from other modules.
237 if (toggleSearchNodeAction) { 237 if (toggleSearchNodeAction) {
238 InspectorFrontendHost.events.addEventListener( 238 InspectorFrontendHost.events.addEventListener(
239 InspectorFrontendHostAPI.Events.EnterInspectElementMode, 239 InspectorFrontendHostAPI.Events.EnterInspectElementMode,
(...skipping 18 matching lines...) Expand all
258 /** 258 /**
259 * @param {string} value 259 * @param {string} value
260 * @param {!Common.QueryParamHandler} handler 260 * @param {!Common.QueryParamHandler} handler
261 */ 261 */
262 function handleQueryParam(value, handler) { 262 function handleQueryParam(value, handler) {
263 handler.handleQueryParam(value); 263 handler.handleQueryParam(value);
264 } 264 }
265 265
266 // Allow UI cycles to repaint prior to creating connection. 266 // Allow UI cycles to repaint prior to creating connection.
267 setTimeout(this._initializeTarget.bind(this), 0); 267 setTimeout(this._initializeTarget.bind(this), 0);
268 console.timeEnd('Main._showAppUI'); 268 Main.timeEnd('Main._showAppUI');
269 } 269 }
270 270
271 _initializeTarget() { 271 _initializeTarget() {
272 console.time('Main._initializeTarget'); 272 Main.time('Main._initializeTarget');
273 SDK.targetManager.connectToMainTarget(webSocketConnectionLost); 273 SDK.targetManager.connectToMainTarget(webSocketConnectionLost);
274 274
275 InspectorFrontendHost.readyForTest(); 275 InspectorFrontendHost.readyForTest();
276 // Asynchronously run the extensions. 276 // Asynchronously run the extensions.
277 setTimeout(this._lateInitialization.bind(this), 100); 277 setTimeout(this._lateInitialization.bind(this), 100);
278 console.timeEnd('Main._initializeTarget'); 278 Main.timeEnd('Main._initializeTarget');
279 279
280 function webSocketConnectionLost() { 280 function webSocketConnectionLost() {
281 if (!Main._disconnectedScreenWithReasonWasShown) 281 if (!Main._disconnectedScreenWithReasonWasShown)
282 Main.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected'); 282 Main.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected');
283 } 283 }
284 } 284 }
285 285
286 _lateInitialization() { 286 _lateInitialization() {
287 console.timeStamp('Main._lateInitialization'); 287 console.timeStamp('Main._lateInitialization');
288 this._registerShortcuts(); 288 this._registerShortcuts();
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 /** 952 /**
953 * @override 953 * @override
954 * @return {?Element} 954 * @return {?Element}
955 */ 955 */
956 settingElement() { 956 settingElement() {
957 return UI.SettingsUI.createSettingCheckbox( 957 return UI.SettingsUI.createSettingCheckbox(
958 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' )); 958 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' ));
959 } 959 }
960 }; 960 };
961 961
962 /**
963 * @param {string} label
964 */
965 Main.time = function(label) {
dgozman 2017/06/19 22:55:52 Use static function in Main class instead.
chenwilliam 2017/06/19 23:48:18 Done.
966 if (Host.isUnderTest())
967 return;
968 console.time(label);
969 };
970
971 /**
972 * @param {string} label
973 */
974 Main.timeEnd = function(label) {
975 if (Host.isUnderTest())
976 return;
977 console.timeEnd(label);
978 };
979
962 new Main.Main(); 980 new Main.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698