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

Side by Side Diff: webkit/glue/devtools/js/tests.js

Issue 218026: DevTools: autoresume execution on parse errors. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * @fileoverview This file contains small testing framework along with the 7 * @fileoverview This file contains small testing framework along with the
8 * test suite for the frontend. These tests are a part of the continues build 8 * test suite for the frontend. These tests are a part of the continues build
9 * and are executed by the devtools_sanity_unittest.cc as a part of the 9 * and are executed by the devtools_sanity_unittest.cc as a part of the
10 * Interactive UI Test suite. 10 * Interactive UI Test suite.
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 test.releaseControl(); 660 test.releaseControl();
661 }); 661 });
662 }); 662 });
663 } 663 }
664 664
665 this.takeControl(); 665 this.takeControl();
666 }; 666 };
667 667
668 668
669 /** 669 /**
670 * Tests that inspected page doesn't hang on reload if it contains a syntax
671 * error and DevTools window is open.
672 */
673 TestSuite.prototype.testAutoContinueOnSyntaxError = function() {
674 this.showPanel('scripts');
675 var test = this;
676
677 function checkScriptsList() {
678 var scriptSelect = document.getElementById('scripts-files');
679 var options = scriptSelect.options;
680 // There should be only console API source (see
681 // InjectedScript._ensureCommandLineAPIInstalled) since the page script
682 // contains a syntax error.
683 for (var i = 0 ; i < options.length; i++) {
684 if (options[i].text.search('script_syntax_error.html$') != -1) {
685 test.fail('Script with syntax error should not be in the list of ' +
686 'parsed scripts.');
687 }
688 }
689 }
690
691 this.addSniffer(devtools.DebuggerAgent.prototype, 'handleScriptsResponse_',
692 function(msg) {
693 checkScriptsList();
694
695 // Reload inspected page.
696 test.evaluateInConsole_(
697 'window.location.reload(true);',
698 function(resultText) {
699 test.assertEquals('undefined', resultText,
700 'Unexpected result of reload().');
701 waitForExceptionEvent();
702 });
703 });
704
705 function waitForExceptionEvent() {
706 var exceptionCount = 0;
707 test.addSniffer(
708 devtools.DebuggerAgent.prototype,
709 'handleExceptionEvent_',
710 function(msg) {
711 exceptionCount++;
712 test.assertEquals(1, exceptionCount, 'Too many exceptions.');
713 test.assertEquals(undefined, msg.getBody().script,
714 'Unexpected exception: ' + JSON.stringify(msg));
715 test.releaseControl();
716 });
717
718 // Check that the script is not paused on parse error.
719 test.addSniffer(
720 WebInspector,
721 'pausedScript',
722 function(callFrames) {
723 test.fail('Script execution should not pause on syntax error.');
724 });
725 }
726
727 this.takeControl();
728 };
729
730
731 /**
670 * Tests 'Pause' button will pause debugger when a snippet is evaluated. 732 * Tests 'Pause' button will pause debugger when a snippet is evaluated.
671 */ 733 */
672 TestSuite.prototype.testPauseInEval = function() { 734 TestSuite.prototype.testPauseInEval = function() {
673 this.showPanel('scripts'); 735 this.showPanel('scripts');
674 736
675 var test = this; 737 var test = this;
676 738
677 var pauseButton = document.getElementById('scripts-pause'); 739 var pauseButton = document.getElementById('scripts-pause');
678 pauseButton.click(); 740 pauseButton.click();
679 741
(...skipping 15 matching lines...) Expand all
695 this.keyIdentifier = key; 757 this.keyIdentifier = key;
696 }; 758 };
697 TestSuite.KeyEvent.prototype.preventDefault = function() {}; 759 TestSuite.KeyEvent.prototype.preventDefault = function() {};
698 TestSuite.KeyEvent.prototype.stopPropagation = function() {}; 760 TestSuite.KeyEvent.prototype.stopPropagation = function() {};
699 761
700 762
701 /** 763 /**
702 * Tests console eval. 764 * Tests console eval.
703 */ 765 */
704 TestSuite.prototype.testConsoleEval = function() { 766 TestSuite.prototype.testConsoleEval = function() {
705 WebInspector.console.visible = true;
706 WebInspector.console.prompt.text = '123';
707 WebInspector.console.promptElement.handleKeyEvent(
708 new TestSuite.KeyEvent('Enter'));
709
710 var test = this; 767 var test = this;
711 this.addSniffer(WebInspector.ConsoleView.prototype, 'addMessage', 768 this.evaluateInConsole_('123',
712 function(commandResult) { 769 function(resultText) {
713 test.assertEquals('123', commandResult.toMessageElement().textContent); 770 test.assertEquals('123', resultText);
714 test.releaseControl(); 771 test.releaseControl();
715 }); 772 });
716 773
717 this.takeControl(); 774 this.takeControl();
718 }; 775 };
719 776
720 777
721 /** 778 /**
722 * Tests console log. 779 * Tests console log.
723 */ 780 */
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 /** 881 /**
825 * Run specified test on a fresh instance of the test suite. 882 * Run specified test on a fresh instance of the test suite.
826 * @param {string} name Name of a test method from TestSuite class. 883 * @param {string} name Name of a test method from TestSuite class.
827 */ 884 */
828 uiTests.runTest = function(name) { 885 uiTests.runTest = function(name) {
829 new TestSuite().runTest(name); 886 new TestSuite().runTest(name);
830 }; 887 };
831 888
832 889
833 } 890 }
OLDNEW
« webkit/glue/devtools/js/debugger_agent.js ('K') | « webkit/glue/devtools/js/debugger_agent.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698