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

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

Issue 1170193002: [DevTools] Add uiTest.testSettings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/Runtime.js ('k') | Source/devtools/front_end/main/Tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @implements {InspectorAgent.Dispatcher} 33 * @implements {InspectorAgent.Dispatcher}
34 * @implements {WebInspector.Console.UIDelegate} 34 * @implements {WebInspector.Console.UIDelegate}
35 * @suppressGlobalPropertiesCheck 35 * @suppressGlobalPropertiesCheck
36 */ 36 */
37 WebInspector.Main = function() 37 WebInspector.Main = function()
38 { 38 {
39 WebInspector.console.setUIDelegate(this); 39 WebInspector.console.setUIDelegate(this);
40 WebInspector.Main._instance = this;
40 runOnWindowLoad(this._loaded.bind(this)); 41 runOnWindowLoad(this._loaded.bind(this));
41 } 42 }
42 43
43 WebInspector.Main.prototype = { 44 WebInspector.Main.prototype = {
44 /** 45 /**
45 * @override 46 * @override
46 * @return {!Promise.<undefined>} 47 * @return {!Promise.<undefined>}
47 */ 48 */
48 showConsole: function() 49 showConsole: function()
49 { 50 {
50 return WebInspector.Revealer.revealPromise(WebInspector.console); 51 return WebInspector.Revealer.revealPromise(WebInspector.console);
51 }, 52 },
52 53
54 /**
55 * @param {function()} callback
56 */
57 _resetSettingsForTest: function(callback)
pfeldman 2015/06/09 12:24:51 Why is this here?
dgozman 2015/06/09 13:55:35 Moved to test.
58 {
59 Runtime.experiments.clearForTest();
60 InspectorFrontendHost.getPreferences(this._createSettings.bind(this, cal lback));
61 },
62
53 _loaded: function() 63 _loaded: function()
54 { 64 {
55 console.timeStamp("Main._loaded"); 65 console.timeStamp("Main._loaded");
56 66
57 if (InspectorFrontendHost.isUnderTest()) 67 if (InspectorFrontendHost.isUnderTest())
58 self.runtime.useTestBase(); 68 self.runtime.useTestBase();
59 InspectorFrontendHost.getPreferences(this._createSettings.bind(this)); 69 InspectorFrontendHost.getPreferences(this._createSettings.bind(this, thi s._createAppUI.bind(this)));
60 }, 70 },
61 71
62 /** 72 /**
73 * @param {function()} callback
63 * @param {!Object<string, string>} prefs 74 * @param {!Object<string, string>} prefs
64 */ 75 */
65 _createSettings: function(prefs) 76 _createSettings: function(callback, prefs)
pfeldman 2015/06/09 12:24:51 This adds indirection.
66 { 77 {
67 // Patch settings from the URL param (for tests). 78 // Patch settings from the URL param (for tests).
68 var settingsParam = Runtime.queryParam("settings"); 79 var settingsParam = Runtime.queryParam("settings");
69 if (settingsParam) { 80 if (settingsParam) {
70 try { 81 try {
71 var settings = JSON.parse(window.decodeURI(settingsParam)); 82 var settings = JSON.parse(window.decodeURI(settingsParam));
72 for (var key in settings) 83 for (var key in settings)
73 prefs[key] = settings[key]; 84 prefs[key] = settings[key];
74 } catch(e) { 85 } catch(e) {
75 // Ignore malformed settings. 86 // Ignore malformed settings.
(...skipping 20 matching lines...) Expand all
96 InspectorFrontendHost.removePreference(name); 107 InspectorFrontendHost.removePreference(name);
97 } 108 }
98 } 109 }
99 110
100 Object.observe(prefs, trackPrefsObject); 111 Object.observe(prefs, trackPrefsObject);
101 WebInspector.settings = new WebInspector.Settings(prefs); 112 WebInspector.settings = new WebInspector.Settings(prefs);
102 113
103 if (!InspectorFrontendHost.isUnderTest()) 114 if (!InspectorFrontendHost.isUnderTest())
104 new WebInspector.VersionController().updateVersion(); 115 new WebInspector.VersionController().updateVersion();
105 116
106 this._createAppUI(); 117 callback();
pfeldman 2015/06/09 12:57:34 Just move this line to the call site (extract a tw
dgozman 2015/06/09 13:55:35 Done.
107 }, 118 },
108 119
109 /** 120 /**
110 * @param {!Object<string, string>} prefs 121 * @param {!Object<string, string>} prefs
111 */ 122 */
112 _initializeExperiments: function(prefs) 123 _initializeExperiments: function(prefs)
113 { 124 {
114 Runtime.experiments.register("accessibilityInspection", "Accessibility I nspection"); 125 Runtime.experiments.register("accessibilityInspection", "Accessibility I nspection");
115 Runtime.experiments.register("animationInspection", "Animation Inspectio n"); 126 Runtime.experiments.register("animationInspection", "Animation Inspectio n");
116 Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI t hemes"); 127 Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI t hemes");
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 p.classList.add("help-section"); 850 p.classList.add("help-section");
840 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once it restarts we will attach to it automatically."); 851 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once it restarts we will attach to it automatically.");
841 } 852 }
842 853
843 WebInspector.WorkerTerminatedScreen.prototype = { 854 WebInspector.WorkerTerminatedScreen.prototype = {
844 855
845 __proto__: WebInspector.HelpScreen.prototype 856 __proto__: WebInspector.HelpScreen.prototype
846 } 857 }
847 858
848 new WebInspector.Main(); 859 new WebInspector.Main();
OLDNEW
« no previous file with comments | « Source/devtools/front_end/Runtime.js ('k') | Source/devtools/front_end/main/Tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698