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

Side by Side Diff: Source/devtools/front_end/Tests.js

Issue 268293003: DevTools: Get rid of WebInspector.panels (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 182
183 /** 183 /**
184 * @param {string} panelName Name of the panel to show. 184 * @param {string} panelName Name of the panel to show.
185 */ 185 */
186 TestSuite.prototype.showPanel = function(panelName) 186 TestSuite.prototype.showPanel = function(panelName)
187 { 187 {
188 // Open Scripts panel. 188 // Open Scripts panel.
189 var button = document.getElementById("tab-" + panelName); 189 var button = document.getElementById("tab-" + panelName);
190 button.selectTabForTest(); 190 button.selectTabForTest();
191 this.assertEquals(WebInspector.panels[panelName], WebInspector.inspectorView .currentPanel()); 191 this.assertEquals(WebInspector.panel(panelName, true), WebInspector.inspecto rView.currentPanel());
192 }; 192 };
193 193
194 194
195 /** 195 /**
196 * Overrides the method with specified name until it's called first time. 196 * Overrides the method with specified name until it's called first time.
197 * @param {!Object} receiver An object whose method to override. 197 * @param {!Object} receiver An object whose method to override.
198 * @param {string} methodName Name of the method to override. 198 * @param {string} methodName Name of the method to override.
199 * @param {!Function} override A function that should be called right after the 199 * @param {!Function} override A function that should be called right after the
200 * overridden method returns. 200 * overridden method returns.
201 * @param {boolean} opt_sticky Whether restore original method after first run 201 * @param {boolean} opt_sticky Whether restore original method after first run
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 247
248 /** 248 /**
249 * Tests that scripts tab is populated with inspected scripts even if it 249 * Tests that scripts tab is populated with inspected scripts even if it
250 * hadn't been shown by the moment inspected paged refreshed. 250 * hadn't been shown by the moment inspected paged refreshed.
251 * @see http://crbug.com/26312 251 * @see http://crbug.com/26312
252 */ 252 */
253 TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function() 253 TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function()
254 { 254 {
255 var test = this; 255 var test = this;
256 this.assertEquals(WebInspector.panels.elements, WebInspector.inspectorView.c urrentPanel(), "Elements panel should be current one."); 256 this.assertEquals(WebInspector.inspectorView.panel("elements"), WebInspector .inspectorView.currentPanel(), "Elements panel should be current one.");
257 257
258 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event s.GlobalObjectCleared, waitUntilScriptIsParsed); 258 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event s.GlobalObjectCleared, waitUntilScriptIsParsed);
259 259
260 // Reload inspected page. It will reset the debugger agent. 260 // Reload inspected page. It will reset the debugger agent.
261 test.evaluateInConsole_("window.location.reload(true);", function(resultText ) {}); 261 test.evaluateInConsole_("window.location.reload(true);", function(resultText ) {});
262 262
263 function waitUntilScriptIsParsed() 263 function waitUntilScriptIsParsed()
264 { 264 {
265 WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerMode l.Events.GlobalObjectCleared, waitUntilScriptIsParsed); 265 WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerMode l.Events.GlobalObjectCleared, waitUntilScriptIsParsed);
266 test.showPanel("sources"); 266 test.showPanel("sources");
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 function didEvaluateInConsole(resultText) { 375 function didEvaluateInConsole(resultText) {
376 this.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultT ext); 376 this.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultT ext);
377 // Wait for some time to make sure that inspected page is running the 377 // Wait for some time to make sure that inspected page is running the
378 // infinite loop. 378 // infinite loop.
379 setTimeout(testScriptPause.bind(this), 300); 379 setTimeout(testScriptPause.bind(this), 300);
380 } 380 }
381 381
382 function testScriptPause() { 382 function testScriptPause() {
383 // The script should be in infinite loop. Click "Pause" button to 383 // The script should be in infinite loop. Click "Pause" button to
384 // pause it and wait for the result. 384 // pause it and wait for the result.
385 WebInspector.panels.sources._pauseButton.element.click(); 385 WebInspector.inspectorView.panel("sources")._pauseButton.element.click() ;
386 386
387 this._waitForScriptPause(this.releaseControl.bind(this)); 387 this._waitForScriptPause(this.releaseControl.bind(this));
388 } 388 }
389 389
390 this.takeControl(); 390 this.takeControl();
391 }; 391 };
392 392
393 393
394 /** 394 /**
395 * Tests network size. 395 * Tests network size.
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 * Waits until all the scripts are parsed and invokes the callback. 904 * Waits until all the scripts are parsed and invokes the callback.
905 */ 905 */
906 TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb ack) 906 TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb ack)
907 { 907 {
908 var test = this; 908 var test = this;
909 909
910 function waitForAllScripts() { 910 function waitForAllScripts() {
911 if (test._scriptsAreParsed(expectedScripts)) 911 if (test._scriptsAreParsed(expectedScripts))
912 callback(); 912 callback();
913 else 913 else
914 test.addSniffer(WebInspector.panels.sources.sourcesView(), "_addUISo urceCode", waitForAllScripts); 914 test.addSniffer(WebInspector.inspectorView.panel("elements").sources View(), "_addUISourceCode", waitForAllScripts);
915 } 915 }
916 916
917 waitForAllScripts(); 917 waitForAllScripts();
918 }; 918 };
919 919
920 920
921 /** 921 /**
922 * Key event with given key identifier. 922 * Key event with given key identifier.
923 */ 923 */
924 TestSuite.createKeyEvent = function(keyIdentifier) 924 TestSuite.createKeyEvent = function(keyIdentifier)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 var oldLoadCompleted = InspectorFrontendAPI.loadCompleted; 974 var oldLoadCompleted = InspectorFrontendAPI.loadCompleted;
975 InspectorFrontendAPI.loadCompleted = function() 975 InspectorFrontendAPI.loadCompleted = function()
976 { 976 {
977 oldLoadCompleted.call(InspectorFrontendAPI); 977 oldLoadCompleted.call(InspectorFrontendAPI);
978 runTests(); 978 runTests();
979 } 979 }
980 980
981 })(); 981 })();
982 982
983 } 983 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698