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

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

Issue 23484056: [DevTools] Renaming Scripts panel to Sources panel (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modified missed files Created 7 years, 3 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
« no previous file with comments | « Source/devtools/front_end/StylesSidebarPane.js ('k') | Source/devtools/front_end/Toolbar.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) 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 238
239 // UI Tests 239 // UI Tests
240 240
241 241
242 /** 242 /**
243 * Tests that scripts tab can be open and populated with inspected scripts. 243 * Tests that scripts tab can be open and populated with inspected scripts.
244 */ 244 */
245 TestSuite.prototype.testShowScriptsTab = function() 245 TestSuite.prototype.testShowScriptsTab = function()
246 { 246 {
247 this.showPanel("scripts"); 247 this.showPanel("sources");
248 var test = this; 248 var test = this;
249 // There should be at least main page script. 249 // There should be at least main page script.
250 this._waitUntilScriptsAreParsed(["debugger_test_page.html"], 250 this._waitUntilScriptsAreParsed(["debugger_test_page.html"],
251 function() { 251 function() {
252 test.releaseControl(); 252 test.releaseControl();
253 }); 253 });
254 // Wait until all scripts are added to the debugger. 254 // Wait until all scripts are added to the debugger.
255 this.takeControl(); 255 this.takeControl();
256 }; 256 };
257 257
258 258
259 /** 259 /**
260 * Tests that scripts tab is populated with inspected scripts even if it 260 * Tests that scripts tab is populated with inspected scripts even if it
261 * hadn't been shown by the moment inspected paged refreshed. 261 * hadn't been shown by the moment inspected paged refreshed.
262 * @see http://crbug.com/26312 262 * @see http://crbug.com/26312
263 */ 263 */
264 TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function() 264 TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function()
265 { 265 {
266 var test = this; 266 var test = this;
267 this.assertEquals(WebInspector.panels.elements, WebInspector.inspectorView.c urrentPanel(), "Elements panel should be current one."); 267 this.assertEquals(WebInspector.panels.elements, WebInspector.inspectorView.c urrentPanel(), "Elements panel should be current one.");
268 268
269 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event s.GlobalObjectCleared, waitUntilScriptIsParsed); 269 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event s.GlobalObjectCleared, waitUntilScriptIsParsed);
270 270
271 // Reload inspected page. It will reset the debugger agent. 271 // Reload inspected page. It will reset the debugger agent.
272 test.evaluateInConsole_("window.location.reload(true);", function(resultText ) {}); 272 test.evaluateInConsole_("window.location.reload(true);", function(resultText ) {});
273 273
274 function waitUntilScriptIsParsed() 274 function waitUntilScriptIsParsed()
275 { 275 {
276 WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerMode l.Events.GlobalObjectCleared, waitUntilScriptIsParsed); 276 WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerMode l.Events.GlobalObjectCleared, waitUntilScriptIsParsed);
277 test.showPanel("scripts"); 277 test.showPanel("sources");
278 test._waitUntilScriptsAreParsed(["debugger_test_page.html"], 278 test._waitUntilScriptsAreParsed(["debugger_test_page.html"],
279 function() { 279 function() {
280 test.releaseControl(); 280 test.releaseControl();
281 }); 281 });
282 } 282 }
283 283
284 // Wait until all scripts are added to the debugger. 284 // Wait until all scripts are added to the debugger.
285 this.takeControl(); 285 this.takeControl();
286 }; 286 };
287 287
288 288
289 /** 289 /**
290 * Tests that scripts list contains content scripts. 290 * Tests that scripts list contains content scripts.
291 */ 291 */
292 TestSuite.prototype.testContentScriptIsPresent = function() 292 TestSuite.prototype.testContentScriptIsPresent = function()
293 { 293 {
294 this.showPanel("scripts"); 294 this.showPanel("sources");
295 var test = this; 295 var test = this;
296 296
297 test._waitUntilScriptsAreParsed( 297 test._waitUntilScriptsAreParsed(
298 ["page_with_content_script.html", "simple_content_script.js"], 298 ["page_with_content_script.html", "simple_content_script.js"],
299 function() { 299 function() {
300 test.releaseControl(); 300 test.releaseControl();
301 }); 301 });
302 302
303 // Wait until all scripts are added to the debugger. 303 // Wait until all scripts are added to the debugger.
304 this.takeControl(); 304 this.takeControl();
305 }; 305 };
306 306
307 307
308 /** 308 /**
309 * Tests that scripts are not duplicaed on Scripts tab switch. 309 * Tests that scripts are not duplicaed on Scripts tab switch.
310 */ 310 */
311 TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function() 311 TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function()
312 { 312 {
313 var test = this; 313 var test = this;
314 314
315 // There should be two scripts: one for the main page and another 315 // There should be two scripts: one for the main page and another
316 // one which is source of console API(see 316 // one which is source of console API(see
317 // InjectedScript._ensureCommandLineAPIInstalled). 317 // InjectedScript._ensureCommandLineAPIInstalled).
318 var expectedScriptsCount = 2; 318 var expectedScriptsCount = 2;
319 var parsedScripts = []; 319 var parsedScripts = [];
320 320
321 this.showPanel("scripts"); 321 this.showPanel("sources");
322 322
323 function switchToElementsTab() { 323 function switchToElementsTab() {
324 test.showPanel("elements"); 324 test.showPanel("elements");
325 setTimeout(switchToScriptsTab, 0); 325 setTimeout(switchToScriptsTab, 0);
326 } 326 }
327 327
328 function switchToScriptsTab() { 328 function switchToScriptsTab() {
329 test.showPanel("scripts"); 329 test.showPanel("sources");
330 setTimeout(checkScriptsPanel, 0); 330 setTimeout(checkScriptsPanel, 0);
331 } 331 }
332 332
333 function checkScriptsPanel() { 333 function checkScriptsPanel() {
334 test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "So me scripts are missing."); 334 test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "So me scripts are missing.");
335 checkNoDuplicates(); 335 checkNoDuplicates();
336 test.releaseControl(); 336 test.releaseControl();
337 } 337 }
338 338
339 function checkNoDuplicates() { 339 function checkNoDuplicates() {
(...skipping 15 matching lines...) Expand all
355 355
356 // Wait until all scripts are added to the debugger. 356 // Wait until all scripts are added to the debugger.
357 this.takeControl(); 357 this.takeControl();
358 }; 358 };
359 359
360 360
361 // Tests that debugger works correctly if pause event occurs when DevTools 361 // Tests that debugger works correctly if pause event occurs when DevTools
362 // frontend is being loaded. 362 // frontend is being loaded.
363 TestSuite.prototype.testPauseWhenLoadingDevTools = function() 363 TestSuite.prototype.testPauseWhenLoadingDevTools = function()
364 { 364 {
365 this.showPanel("scripts"); 365 this.showPanel("sources");
366 366
367 // Script execution can already be paused. 367 // Script execution can already be paused.
368 if (WebInspector.debuggerModel.debuggerPausedDetails) 368 if (WebInspector.debuggerModel.debuggerPausedDetails)
369 return; 369 return;
370 370
371 this._waitForScriptPause(this.releaseControl.bind(this)); 371 this._waitForScriptPause(this.releaseControl.bind(this));
372 this.takeControl(); 372 this.takeControl();
373 }; 373 };
374 374
375 375
376 // Tests that pressing "Pause" will pause script execution if the script 376 // Tests that pressing "Pause" will pause script execution if the script
377 // is already running. 377 // is already running.
378 TestSuite.prototype.testPauseWhenScriptIsRunning = function() 378 TestSuite.prototype.testPauseWhenScriptIsRunning = function()
379 { 379 {
380 this.showPanel("scripts"); 380 this.showPanel("sources");
381 381
382 this.evaluateInConsole_( 382 this.evaluateInConsole_(
383 'setTimeout("handleClick()" , 0)', 383 'setTimeout("handleClick()" , 0)',
384 didEvaluateInConsole.bind(this)); 384 didEvaluateInConsole.bind(this));
385 385
386 function didEvaluateInConsole(resultText) { 386 function didEvaluateInConsole(resultText) {
387 this.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultT ext); 387 this.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultT ext);
388 // Wait for some time to make sure that inspected page is running the 388 // Wait for some time to make sure that inspected page is running the
389 // infinite loop. 389 // infinite loop.
390 setTimeout(testScriptPause.bind(this), 300); 390 setTimeout(testScriptPause.bind(this), 300);
391 } 391 }
392 392
393 function testScriptPause() { 393 function testScriptPause() {
394 // The script should be in infinite loop. Click "Pause" button to 394 // The script should be in infinite loop. Click "Pause" button to
395 // pause it and wait for the result. 395 // pause it and wait for the result.
396 WebInspector.panels.scripts._pauseButton.element.click(); 396 WebInspector.panels.sources._pauseButton.element.click();
397 397
398 this._waitForScriptPause(this.releaseControl.bind(this)); 398 this._waitForScriptPause(this.releaseControl.bind(this));
399 } 399 }
400 400
401 this.takeControl(); 401 this.takeControl();
402 }; 402 };
403 403
404 404
405 /** 405 /**
406 * Tests network size. 406 * Tests network size.
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 * Waits until all the scripts are parsed and invokes the callback. 902 * Waits until all the scripts are parsed and invokes the callback.
903 */ 903 */
904 TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb ack) 904 TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb ack)
905 { 905 {
906 var test = this; 906 var test = this;
907 907
908 function waitForAllScripts() { 908 function waitForAllScripts() {
909 if (test._scriptsAreParsed(expectedScripts)) 909 if (test._scriptsAreParsed(expectedScripts))
910 callback(); 910 callback();
911 else 911 else
912 test.addSniffer(WebInspector.panels.scripts, "_addUISourceCode", wai tForAllScripts); 912 test.addSniffer(WebInspector.panels.sources, "_addUISourceCode", wai tForAllScripts);
913 } 913 }
914 914
915 waitForAllScripts(); 915 waitForAllScripts();
916 }; 916 };
917 917
918 918
919 /** 919 /**
920 * Key event with given key identifier. 920 * Key event with given key identifier.
921 */ 921 */
922 TestSuite.createKeyEvent = function(keyIdentifier) 922 TestSuite.createKeyEvent = function(keyIdentifier)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 var oldLoadCompleted = InspectorFrontendAPI.loadCompleted; 972 var oldLoadCompleted = InspectorFrontendAPI.loadCompleted;
973 InspectorFrontendAPI.loadCompleted = function() 973 InspectorFrontendAPI.loadCompleted = function()
974 { 974 {
975 oldLoadCompleted.call(InspectorFrontendAPI); 975 oldLoadCompleted.call(InspectorFrontendAPI);
976 runTests(); 976 runTests();
977 } 977 }
978 978
979 })(); 979 })();
980 980
981 } 981 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/StylesSidebarPane.js ('k') | Source/devtools/front_end/Toolbar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698