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

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: Created 3 years, 7 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 Runtime.experiments.enableForTest('liveSASS'); 137 Runtime.experiments.enableForTest('liveSASS');
138 } 138 }
139 139
140 Runtime.experiments.setDefaultExperiments([]); 140 Runtime.experiments.setDefaultExperiments([]);
141 } 141 }
142 142
143 /** 143 /**
144 * @suppressGlobalPropertiesCheck 144 * @suppressGlobalPropertiesCheck
145 */ 145 */
146 _createAppUI() { 146 _createAppUI() {
147 console.time('Main._createAppUI'); 147 Main.time('Main._createAppUI');
148 148
149 UI.viewManager = new UI.ViewManager(); 149 UI.viewManager = new UI.ViewManager();
150 150
151 // Request filesystems early, we won't create connections until callback is fired. Things will happen in parallel. 151 // Request filesystems early, we won't create connections until callback is fired. Things will happen in parallel.
152 Workspace.isolatedFileSystemManager = new Workspace.IsolatedFileSystemManage r(); 152 Workspace.isolatedFileSystemManager = new Workspace.IsolatedFileSystemManage r();
153 153
154 var themeSetting = Common.settings.createSetting('uiTheme', 'default'); 154 var themeSetting = Common.settings.createSetting('uiTheme', 'default');
155 UI.initializeUIUtils(document, themeSetting); 155 UI.initializeUIUtils(document, themeSetting);
156 themeSetting.addChangeListener(Components.reload.bind(Components)); 156 themeSetting.addChangeListener(Components.reload.bind(Components));
157 157
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 new Main.BackendSettingsSync(); 207 new Main.BackendSettingsSync();
208 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane(); 208 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane();
209 209
210 UI.actionRegistry = new UI.ActionRegistry(); 210 UI.actionRegistry = new UI.ActionRegistry();
211 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document); 211 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document);
212 UI.ShortcutsScreen.registerShortcuts(); 212 UI.ShortcutsScreen.registerShortcuts();
213 this._registerForwardedShortcuts(); 213 this._registerForwardedShortcuts();
214 this._registerMessageSinkListener(); 214 this._registerMessageSinkListener();
215 215
216 self.runtime.extension(Common.AppProvider).instance().then(this._showAppUI.b ind(this)); 216 self.runtime.extension(Common.AppProvider).instance().then(this._showAppUI.b ind(this));
217 console.timeEnd('Main._createAppUI'); 217 Main.timeEnd('Main._createAppUI');
218 } 218 }
219 219
220 /** 220 /**
221 * @param {!Object} appProvider 221 * @param {!Object} appProvider
222 * @suppressGlobalPropertiesCheck 222 * @suppressGlobalPropertiesCheck
223 */ 223 */
224 _showAppUI(appProvider) { 224 _showAppUI(appProvider) {
225 console.time('Main._showAppUI'); 225 Main.time('Main._showAppUI');
226 var app = /** @type {!Common.AppProvider} */ (appProvider).createApp(); 226 var app = /** @type {!Common.AppProvider} */ (appProvider).createApp();
227 // It is important to kick controller lifetime after apps are instantiated. 227 // It is important to kick controller lifetime after apps are instantiated.
228 Components.dockController.initialize(); 228 Components.dockController.initialize();
229 app.presentUI(document); 229 app.presentUI(document);
230 230
231 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme nt-search'); 231 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme nt-search');
232 // TODO: we should not access actions from other modules. 232 // TODO: we should not access actions from other modules.
233 if (toggleSearchNodeAction) { 233 if (toggleSearchNodeAction) {
234 InspectorFrontendHost.events.addEventListener( 234 InspectorFrontendHost.events.addEventListener(
235 InspectorFrontendHostAPI.Events.EnterInspectElementMode, 235 InspectorFrontendHostAPI.Events.EnterInspectElementMode,
(...skipping 18 matching lines...) Expand all
254 /** 254 /**
255 * @param {string} value 255 * @param {string} value
256 * @param {!Common.QueryParamHandler} handler 256 * @param {!Common.QueryParamHandler} handler
257 */ 257 */
258 function handleQueryParam(value, handler) { 258 function handleQueryParam(value, handler) {
259 handler.handleQueryParam(value); 259 handler.handleQueryParam(value);
260 } 260 }
261 261
262 // Allow UI cycles to repaint prior to creating connection. 262 // Allow UI cycles to repaint prior to creating connection.
263 setTimeout(this._initializeTarget.bind(this), 0); 263 setTimeout(this._initializeTarget.bind(this), 0);
264 console.timeEnd('Main._showAppUI'); 264 Main.timeEnd('Main._showAppUI');
265 } 265 }
266 266
267 _initializeTarget() { 267 _initializeTarget() {
268 console.time('Main._initializeTarget'); 268 Main.time('Main._initializeTarget');
269 SDK.targetManager.connectToMainTarget(webSocketConnectionLost); 269 SDK.targetManager.connectToMainTarget(webSocketConnectionLost);
270 270
271 InspectorFrontendHost.readyForTest(); 271 InspectorFrontendHost.readyForTest();
272 // Asynchronously run the extensions. 272 // Asynchronously run the extensions.
273 setTimeout(this._lateInitialization.bind(this), 100); 273 setTimeout(this._lateInitialization.bind(this), 100);
274 console.timeEnd('Main._initializeTarget'); 274 Main.timeEnd('Main._initializeTarget');
275 275
276 function webSocketConnectionLost() { 276 function webSocketConnectionLost() {
277 if (!Main._disconnectedScreenWithReasonWasShown) 277 if (!Main._disconnectedScreenWithReasonWasShown)
278 Main.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected'); 278 Main.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected');
279 } 279 }
280 } 280 }
281 281
282 _lateInitialization() { 282 _lateInitialization() {
283 console.timeStamp('Main._lateInitialization'); 283 console.timeStamp('Main._lateInitialization');
284 this._registerShortcuts(); 284 this._registerShortcuts();
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 * @override 952 * @override
953 * @return {?Element} 953 * @return {?Element}
954 */ 954 */
955 settingElement() { 955 settingElement() {
956 return UI.SettingsUI.createSettingCheckbox( 956 return UI.SettingsUI.createSettingCheckbox(
957 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' )); 957 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' ));
958 } 958 }
959 }; 959 };
960 960
961 new Main.Main(); 961 new Main.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698