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

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

Issue 881263002: DevTools: use target-based model accessors only. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 281
282 /** 282 /**
283 * Tests that scripts tab is populated with inspected scripts even if it 283 * Tests that scripts tab is populated with inspected scripts even if it
284 * hadn't been shown by the moment inspected paged refreshed. 284 * hadn't been shown by the moment inspected paged refreshed.
285 * @see http://crbug.com/26312 285 * @see http://crbug.com/26312
286 */ 286 */
287 TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function() 287 TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function()
288 { 288 {
289 var test = this; 289 var test = this;
290 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event s.GlobalObjectCleared, waitUntilScriptIsParsed); 290 var debuggerModel = WebInspector.targetManager.mainTarget().debuggerModel;
291 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec tCleared, waitUntilScriptIsParsed);
291 292
292 this.showPanel("elements").then(function() { 293 this.showPanel("elements").then(function() {
293 // Reload inspected page. It will reset the debugger agent. 294 // Reload inspected page. It will reset the debugger agent.
294 test.evaluateInConsole_("window.location.reload(true);", function(result Text) {}); 295 test.evaluateInConsole_("window.location.reload(true);", function(result Text) {});
295 }); 296 });
296 297
297 function waitUntilScriptIsParsed() 298 function waitUntilScriptIsParsed()
298 { 299 {
299 WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerMode l.Events.GlobalObjectCleared, waitUntilScriptIsParsed); 300 debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.Glob alObjectCleared, waitUntilScriptIsParsed);
300 test.showPanel("sources").then(function() { 301 test.showPanel("sources").then(function() {
301 test._waitUntilScriptsAreParsed(["debugger_test_page.html"], 302 test._waitUntilScriptsAreParsed(["debugger_test_page.html"],
302 function() { 303 function() {
303 test.releaseControl(); 304 test.releaseControl();
304 }); 305 });
305 }); 306 });
306 } 307 }
307 308
308 // Wait until all scripts are added to the debugger. 309 // Wait until all scripts are added to the debugger.
309 this.takeControl(); 310 this.takeControl();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 381
381 // Wait until all scripts are added to the debugger. 382 // Wait until all scripts are added to the debugger.
382 this.takeControl(); 383 this.takeControl();
383 }; 384 };
384 385
385 386
386 // Tests that debugger works correctly if pause event occurs when DevTools 387 // Tests that debugger works correctly if pause event occurs when DevTools
387 // frontend is being loaded. 388 // frontend is being loaded.
388 TestSuite.prototype.testPauseWhenLoadingDevTools = function() 389 TestSuite.prototype.testPauseWhenLoadingDevTools = function()
389 { 390 {
390 if (WebInspector.debuggerModel.debuggerPausedDetails) 391 var debuggerModel = WebInspector.targetManager.mainTarget().debuggerModel;
392 if (debuggerModel.debuggerPausedDetails)
391 return; 393 return;
392 394
393 this.showPanel("sources").then(function() { 395 this.showPanel("sources").then(function() {
394 // Script execution can already be paused. 396 // Script execution can already be paused.
395 397
396 this._waitForScriptPause(this.releaseControl.bind(this)); 398 this._waitForScriptPause(this.releaseControl.bind(this));
397 }.bind(this)); 399 }.bind(this));
398 400
399 this.takeControl(); 401 this.takeControl();
400 }; 402 };
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 function didCompleteNavigation() { 562 function didCompleteNavigation() {
561 this.assertEquals(7, WebInspector.multitargetConsoleModel.messages().len gth); 563 this.assertEquals(7, WebInspector.multitargetConsoleModel.messages().len gth);
562 this.releaseControl(); 564 this.releaseControl();
563 } 565 }
564 566
565 this.takeControl(); 567 this.takeControl();
566 }; 568 };
567 569
568 TestSuite.prototype.testReattachAfterCrash = function() 570 TestSuite.prototype.testReattachAfterCrash = function()
569 { 571 {
570 WebInspector.targetManager.mainTarget().pageAgent().navigate("about:crash"); 572 var target = WebInspector.targetManager.mainTarget();
571 WebInspector.targetManager.mainTarget().pageAgent().navigate("about:blank"); 573 target.pageAgent().navigate("about:crash");
572 WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events. ExecutionContextCreated, this.releaseControl, this); 574 target.pageAgent().navigate("about:blank");
575 target.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.Execut ionContextCreated, this.releaseControl, this);
573 }; 576 };
574 577
575 578
576 TestSuite.prototype.testSharedWorker = function() 579 TestSuite.prototype.testSharedWorker = function()
577 { 580 {
578 function didEvaluateInConsole(resultText) { 581 function didEvaluateInConsole(resultText) {
579 this.assertEquals("2011", resultText); 582 this.assertEquals("2011", resultText);
580 this.releaseControl(); 583 this.releaseControl();
581 } 584 }
582 this.evaluateInConsole_("globalVar", didEvaluateInConsole.bind(this)); 585 this.evaluateInConsole_("globalVar", didEvaluateInConsole.bind(this));
(...skipping 19 matching lines...) Expand all
602 if (isReady()) { 605 if (isReady()) {
603 this.releaseControl(); 606 this.releaseControl();
604 return; 607 return;
605 } 608 }
606 this.addSniffer(WebInspector.TargetManager.prototype, "addTarget", targe tAdded.bind(this)); 609 this.addSniffer(WebInspector.TargetManager.prototype, "addTarget", targe tAdded.bind(this));
607 } 610 }
608 }; 611 };
609 612
610 TestSuite.prototype.testPauseInSharedWorkerInitialization2 = function() 613 TestSuite.prototype.testPauseInSharedWorkerInitialization2 = function()
611 { 614 {
612 if (WebInspector.debuggerModel.isPaused()) 615 var debuggerModel = WebInspector.targetManager.mainTarget().debuggerModel;
616 if (debuggerModel.isPaused())
613 return; 617 return;
614 this._waitForScriptPause(this.releaseControl.bind(this)); 618 this._waitForScriptPause(this.releaseControl.bind(this));
615 this.takeControl(); 619 this.takeControl();
616 }; 620 };
617 621
618 TestSuite.prototype.enableTouchEmulation = function() 622 TestSuite.prototype.enableTouchEmulation = function()
619 { 623 {
620 WebInspector.targetManager.mainTarget().domModel.emulateTouchEventObjects(tr ue, "mobile"); 624 WebInspector.targetManager.mainTarget().domModel.emulateTouchEventObjects(tr ue, "mobile");
621 }; 625 };
622 626
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } 944 }
941 945
942 WebInspector.notifications.addEventListener(WebInspector.NotificationService.Eve nts.InspectorAgentEnabledForTests, runTests); 946 WebInspector.notifications.addEventListener(WebInspector.NotificationService.Eve nts.InspectorAgentEnabledForTests, runTests);
943 947
944 return TestSuite; 948 return TestSuite;
945 949
946 } 950 }
947 951
948 if (window.parent && window.parent.uiTests) 952 if (window.parent && window.parent.uiTests)
949 window.parent.uiTests.testSuiteReady(createTestSuite); 953 window.parent.uiTests.testSuiteReady(createTestSuite);
OLDNEW
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | Source/devtools/front_end/network/NetworkLogView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698