OLD | NEW |
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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 this.keyIdentifier = key; | 375 this.keyIdentifier = key; |
376 }; | 376 }; |
377 TestSuite.KeyEvent.prototype.preventDefault = function() {}; | 377 TestSuite.KeyEvent.prototype.preventDefault = function() {}; |
378 TestSuite.KeyEvent.prototype.stopPropagation = function() {}; | 378 TestSuite.KeyEvent.prototype.stopPropagation = function() {}; |
379 | 379 |
380 | 380 |
381 /** | 381 /** |
382 * Tests console eval. | 382 * Tests console eval. |
383 */ | 383 */ |
384 TestSuite.prototype.testConsoleEval = function(controller) { | 384 TestSuite.prototype.testConsoleEval = function(controller) { |
| 385 WebInspector.console.visible = true; |
| 386 WebInspector.console.prompt.text = '123'; |
| 387 WebInspector.console.promptElement.handleKeyEvent( |
| 388 new TestSuite.KeyEvent('Enter')); |
| 389 |
385 var test = this; | 390 var test = this; |
386 var originalConsoleAddMessage = WebInspector.Console.prototype.addMessage; | 391 var originalConsoleAddMessage = WebInspector.Console.prototype.addMessage; |
387 WebInspector.Console.prototype.addMessage = function(commandResult) { | 392 WebInspector.Console.prototype.addMessage = function(commandResult) { |
388 originalConsoleAddMessage.call(this, commandResult); | 393 originalConsoleAddMessage.call(this, commandResult); |
389 WebInspector.Console.prototype.addMessage = originalConsoleAddMessage; | 394 WebInspector.Console.prototype.addMessage = originalConsoleAddMessage; |
390 test.assertEquals('123', commandResult.toMessageElement().textContent); | 395 test.assertEquals('123', commandResult.toMessageElement().textContent); |
391 controller.releaseControl(); | 396 controller.releaseControl(); |
392 }; | 397 }; |
393 | 398 |
394 WebInspector.console.visible = true; | |
395 WebInspector.console.prompt.text = '123'; | |
396 WebInspector.console.promptElement.handleKeyEvent( | |
397 new TestSuite.KeyEvent('Enter')); | |
398 | |
399 controller.takeControl(); | 399 controller.takeControl(); |
400 }; | 400 }; |
401 | 401 |
402 | 402 |
403 /** | 403 /** |
404 * Tests console log. | 404 * Tests console log. |
405 */ | 405 */ |
406 TestSuite.prototype.testConsoleLog = function(controller) { | 406 TestSuite.prototype.testConsoleLog = function(controller) { |
407 WebInspector.console.visible = true; | 407 WebInspector.console.visible = true; |
408 var messages = WebInspector.console.messages; | 408 var messages = WebInspector.console.messages; |
(...skipping 29 matching lines...) Expand all Loading... |
438 assertNext('29', 'group', 'group-title'); | 438 assertNext('29', 'group', 'group-title'); |
439 index++; | 439 index++; |
440 assertNext('33', 'timer:', 'log', '', true); | 440 assertNext('33', 'timer:', 'log', '', true); |
441 }; | 441 }; |
442 | 442 |
443 | 443 |
444 /** | 444 /** |
445 * Tests eval of global objects. | 445 * Tests eval of global objects. |
446 */ | 446 */ |
447 TestSuite.prototype.testEvalGlobal = function(controller) { | 447 TestSuite.prototype.testEvalGlobal = function(controller) { |
448 var test = this; | |
449 var originalConsoleAddMessage = WebInspector.Console.prototype.addMessage; | |
450 WebInspector.Console.prototype.addMessage = function(commandResult) { | |
451 originalConsoleAddMessage.call(this, commandResult); | |
452 WebInspector.Console.prototype.addMessage = originalConsoleAddMessage; | |
453 test.assertEquals('fooValue', commandResult.toMessageElement().textContent); | |
454 controller.releaseControl(); | |
455 }; | |
456 | |
457 WebInspector.console.visible = true; | 448 WebInspector.console.visible = true; |
458 WebInspector.console.prompt.text = 'foo'; | 449 WebInspector.console.prompt.text = 'foo'; |
459 WebInspector.console.promptElement.handleKeyEvent( | 450 WebInspector.console.promptElement.handleKeyEvent( |
460 new TestSuite.KeyEvent('Enter')); | 451 new TestSuite.KeyEvent('Enter')); |
461 | 452 |
| 453 var test = this; |
| 454 var originalConsoleAddMessage = WebInspector.Console.prototype.addMessage; |
| 455 WebInspector.Console.prototype.addMessage = function(commandResult) { |
| 456 originalConsoleAddMessage.call(this, commandResult); |
| 457 test.assertEquals('fooValue', commandResult.toMessageElement().textContent); |
| 458 controller.releaseControl(); |
| 459 }; |
| 460 |
462 controller.takeControl(); | 461 controller.takeControl(); |
463 }; | 462 }; |
464 | 463 |
465 | 464 |
466 /** | 465 /** |
467 * Tests eval on call frame. | 466 * Tests eval on call frame. |
468 */ | 467 */ |
469 TestSuite.prototype.testEvalCallFrame = function(controller) { | 468 TestSuite.prototype.testEvalCallFrame = function(controller) { |
470 }; | 469 }; |
471 | 470 |
472 | 471 |
473 var uiTests = new TestSuite(); | 472 var uiTests = new TestSuite(); |
474 } | 473 } |
OLD | NEW |