diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 08:49:09 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 08:49:09 +0000 |
commit | b7988f14ac80f4e72d429aef4e67beb695f767b0 (patch) | |
tree | 9e51f0d2206458d22bfd6c8e90e5fb75624f59e3 /webkit/glue | |
parent | 6e704be1995d532844991add1de569020835f4f7 (diff) | |
download | chromium_src-b7988f14ac80f4e72d429aef4e67beb695f767b0.zip chromium_src-b7988f14ac80f4e72d429aef4e67beb695f767b0.tar.gz chromium_src-b7988f14ac80f4e72d429aef4e67beb695f767b0.tar.bz2 |
DevTools: Add more console tests.
BUG=22570
Review URL: http://codereview.chromium.org/212047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26909 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/devtools/js/tests.js | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/webkit/glue/devtools/js/tests.js b/webkit/glue/devtools/js/tests.js index ae28aed..635b947 100644 --- a/webkit/glue/devtools/js/tests.js +++ b/webkit/glue/devtools/js/tests.js @@ -619,6 +619,9 @@ TestSuite.prototype.testConsoleLog = function() { assertNext('29', 'group', 'group-title'); index++; assertNext('33', 'timer:', 'log-level', '', true); + assertNext('35', '1 2 3', 'log-level'); + assertNext('37', 'HTMLDocument', 'log-level'); + assertNext('39', '<html>', 'log-level', '', true); }; @@ -627,18 +630,36 @@ TestSuite.prototype.testConsoleLog = function() { */ TestSuite.prototype.testEvalGlobal = function() { WebInspector.console.visible = true; - WebInspector.console.prompt.text = 'foo'; - WebInspector.console.promptElement.handleKeyEvent( - new TestSuite.KeyEvent('Enter')); + var inputs = ['foo', 'foobar']; + var expectations = ['foo', 'fooValue', + 'foobar', 'ReferenceError: foobar is not defined']; + + // Do not change code below - simply add inputs and expectations above. + var initEval = function(input) { + WebInspector.console.prompt.text = input; + WebInspector.console.promptElement.handleKeyEvent( + new TestSuite.KeyEvent('Enter')); + }; var test = this; + var messagesCount = 0; + var inputIndex = 0; this.addSniffer(WebInspector.ConsoleView.prototype, 'addMessage', function(commandResult) { - test.assertEquals('fooValue', - commandResult.toMessageElement().textContent); - test.releaseControl(); - }); + messagesCount++; + if (messagesCount == expectations.length) { + var messages = WebInspector.console.messages; + for (var i = 0; i < expectations; ++i) { + var elem = messages[i++].toMessageElement(); + test.assertEquals(elem.textContent, expectations[i]); + } + test.releaseControl(); + } else if (messagesCount % 2 == 0) { + initEval(inputs[inputIndex++]); + } + }, true); + initEval(inputs[inputIndex++]); this.takeControl(); }; |