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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2742623002: DevTools: improve test infrastructure w/ devtools driving the test (Closed)
Patch Set: fixup Created 3 years, 9 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 Runtime.experiments.register('sourceDiff', 'Source diff'); 115 Runtime.experiments.register('sourceDiff', 'Source diff');
116 Runtime.experiments.register('terminalInDrawer', 'Terminal in drawer', true) ; 116 Runtime.experiments.register('terminalInDrawer', 'Terminal in drawer', true) ;
117 Runtime.experiments.register('timelineInvalidationTracking', 'Timeline inval idation tracking', true); 117 Runtime.experiments.register('timelineInvalidationTracking', 'Timeline inval idation tracking', true);
118 Runtime.experiments.register('timelineMultipleMainViews', 'Tabbed views on P erformance panel'); 118 Runtime.experiments.register('timelineMultipleMainViews', 'Tabbed views on P erformance panel');
119 Runtime.experiments.register('timelineTracingJSProfile', 'Timeline tracing b ased JS profiler', true); 119 Runtime.experiments.register('timelineTracingJSProfile', 'Timeline tracing b ased JS profiler', true);
120 Runtime.experiments.register('timelineV8RuntimeCallStats', 'V8 Runtime Call Stats on Timeline', true); 120 Runtime.experiments.register('timelineV8RuntimeCallStats', 'V8 Runtime Call Stats on Timeline', true);
121 Runtime.experiments.register('timelinePerFrameTrack', 'Show track per frame on Timeline', true); 121 Runtime.experiments.register('timelinePerFrameTrack', 'Show track per frame on Timeline', true);
122 122
123 Runtime.experiments.cleanUpStaleExperiments(); 123 Runtime.experiments.cleanUpStaleExperiments();
124 124
125 var test = Runtime.queryParam('test');
126 if (test && test.indexOf('/devtools-js/') !== -1)
127 Runtime.experiments.enableForTest('releaseNote');
128
125 if (Host.isUnderTest(prefs)) { 129 if (Host.isUnderTest(prefs)) {
126 var testPath = JSON.parse(prefs['testPath'] || '""'); 130 var testPath = JSON.parse(prefs['testPath'] || '""');
127 // Enable experiments for testing. 131 // Enable experiments for testing.
128 if (testPath.indexOf('accessibility/') !== -1) 132 if (testPath.indexOf('accessibility/') !== -1)
129 Runtime.experiments.enableForTest('accessibilityInspection'); 133 Runtime.experiments.enableForTest('accessibilityInspection');
130 if (testPath.indexOf('coverage') !== -1) 134 if (testPath.indexOf('coverage') !== -1)
131 Runtime.experiments.enableForTest('cssTrackerPanel'); 135 Runtime.experiments.enableForTest('cssTrackerPanel');
132 if (testPath.indexOf('audits2/') !== -1) 136 if (testPath.indexOf('audits2/') !== -1)
133 Runtime.experiments.enableForTest('audits2'); 137 Runtime.experiments.enableForTest('audits2');
134 if (testPath.indexOf('help/') !== -1) 138 if (testPath.indexOf('help/') !== -1)
135 Runtime.experiments.enableForTest('releaseNote'); 139 Runtime.experiments.enableForTest('releaseNote');
136 } 140 }
137 141
138 Runtime.experiments.setDefaultExperiments(['persistenceValidation']); 142 Runtime.experiments.setDefaultExperiments(['persistenceValidation']);
139 } 143 }
140 144
141 /** 145 /**
142 * @suppressGlobalPropertiesCheck 146 * @suppressGlobalPropertiesCheck
143 */ 147 */
144 _createAppUI() { 148 _createAppUI() {
145 console.time('Main._createAppUI'); 149 Main.time('Main._createAppUI');
146 150
147 UI.viewManager = new UI.ViewManager(); 151 UI.viewManager = new UI.ViewManager();
148 152
149 // Request filesystems early, we won't create connections until callback is fired. Things will happen in parallel. 153 // Request filesystems early, we won't create connections until callback is fired. Things will happen in parallel.
150 Workspace.isolatedFileSystemManager = new Workspace.IsolatedFileSystemManage r(); 154 Workspace.isolatedFileSystemManager = new Workspace.IsolatedFileSystemManage r();
151 155
152 var themeSetting = Common.settings.createSetting('uiTheme', 'default'); 156 var themeSetting = Common.settings.createSetting('uiTheme', 'default');
153 UI.initializeUIUtils(document, themeSetting); 157 UI.initializeUIUtils(document, themeSetting);
154 themeSetting.addChangeListener(Components.reload.bind(Components)); 158 themeSetting.addChangeListener(Components.reload.bind(Components));
155 159
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane(); 209 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane();
206 210
207 UI.actionRegistry = new UI.ActionRegistry(); 211 UI.actionRegistry = new UI.ActionRegistry();
208 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document); 212 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document);
209 UI.ShortcutsScreen.registerShortcuts(); 213 UI.ShortcutsScreen.registerShortcuts();
210 this._registerForwardedShortcuts(); 214 this._registerForwardedShortcuts();
211 this._registerMessageSinkListener(); 215 this._registerMessageSinkListener();
212 new Main.Main.InspectorDomainObserver(); 216 new Main.Main.InspectorDomainObserver();
213 217
214 self.runtime.extension(Common.AppProvider).instance().then(this._showAppUI.b ind(this)); 218 self.runtime.extension(Common.AppProvider).instance().then(this._showAppUI.b ind(this));
215 console.timeEnd('Main._createAppUI'); 219 Main.timeEnd('Main._createAppUI');
216 } 220 }
217 221
218 /** 222 /**
219 * @param {!Object} appProvider 223 * @param {!Object} appProvider
220 * @suppressGlobalPropertiesCheck 224 * @suppressGlobalPropertiesCheck
221 */ 225 */
222 _showAppUI(appProvider) { 226 _showAppUI(appProvider) {
223 console.time('Main._showAppUI'); 227 Main.time('Main._showAppUI');
224 var app = /** @type {!Common.AppProvider} */ (appProvider).createApp(); 228 var app = /** @type {!Common.AppProvider} */ (appProvider).createApp();
225 // It is important to kick controller lifetime after apps are instantiated. 229 // It is important to kick controller lifetime after apps are instantiated.
226 Components.dockController.initialize(); 230 Components.dockController.initialize();
227 app.presentUI(document); 231 app.presentUI(document);
228 232
229 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme nt-search'); 233 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme nt-search');
230 // TODO: we should not access actions from other modules. 234 // TODO: we should not access actions from other modules.
231 if (toggleSearchNodeAction) { 235 if (toggleSearchNodeAction) {
232 InspectorFrontendHost.events.addEventListener( 236 InspectorFrontendHost.events.addEventListener(
233 InspectorFrontendHostAPI.Events.EnterInspectElementMode, 237 InspectorFrontendHostAPI.Events.EnterInspectElementMode,
(...skipping 18 matching lines...) Expand all
252 /** 256 /**
253 * @param {string} value 257 * @param {string} value
254 * @param {!Common.QueryParamHandler} handler 258 * @param {!Common.QueryParamHandler} handler
255 */ 259 */
256 function handleQueryParam(value, handler) { 260 function handleQueryParam(value, handler) {
257 handler.handleQueryParam(value); 261 handler.handleQueryParam(value);
258 } 262 }
259 263
260 // Allow UI cycles to repaint prior to creating connection. 264 // Allow UI cycles to repaint prior to creating connection.
261 setTimeout(this._initializeTarget.bind(this), 0); 265 setTimeout(this._initializeTarget.bind(this), 0);
262 console.timeEnd('Main._showAppUI'); 266 Main.timeEnd('Main._showAppUI');
263 } 267 }
264 268
265 _initializeTarget() { 269 _initializeTarget() {
266 console.time('Main._initializeTarget'); 270 Main.time('Main._initializeTarget');
267 SDK.targetManager.connectToMainTarget(webSocketConnectionLost); 271 SDK.targetManager.connectToMainTarget(webSocketConnectionLost);
268 272
269 InspectorFrontendHost.readyForTest(); 273 InspectorFrontendHost.readyForTest();
270 // Asynchronously run the extensions. 274 // Asynchronously run the extensions.
271 setTimeout(this._lateInitialization.bind(this), 100); 275 setTimeout(this._lateInitialization.bind(this), 100);
272 console.timeEnd('Main._initializeTarget'); 276 Main.timeEnd('Main._initializeTarget');
273 277
274 function webSocketConnectionLost() { 278 function webSocketConnectionLost() {
275 if (!Main._disconnectedScreenWithReasonWasShown) 279 if (!Main._disconnectedScreenWithReasonWasShown)
276 Main.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected'); 280 Main.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected');
277 } 281 }
278 } 282 }
279 283
280 _lateInitialization() { 284 _lateInitialization() {
281 console.timeStamp('Main._lateInitialization'); 285 console.timeStamp('Main._lateInitialization');
282 this._registerShortcuts(); 286 this._registerShortcuts();
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 * @override 989 * @override
986 * @return {?Element} 990 * @return {?Element}
987 */ 991 */
988 settingElement() { 992 settingElement() {
989 return UI.SettingsUI.createSettingCheckbox( 993 return UI.SettingsUI.createSettingCheckbox(
990 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' )); 994 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' ));
991 } 995 }
992 }; 996 };
993 997
994 new Main.Main(); 998 new Main.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698