| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * Test fixture for print preview WebUI testing. | 6 * Test fixture for print preview WebUI testing. |
| 7 * @extends {testing.Test} | 7 * @extends {testing.Test} |
| 8 * @constructor | 8 * @constructor |
| 9 */ | 9 */ |
| 10 function PrintPreviewWebUITest() {} | 10 function PrintPreviewWebUITest() {} |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 391 |
| 392 // Test that error message is displayed when plugin doesn't exist. | 392 // Test that error message is displayed when plugin doesn't exist. |
| 393 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { | 393 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { |
| 394 var errorButton = $('error-button'); | 394 var errorButton = $('error-button'); |
| 395 assertNotEquals(null, errorButton); | 395 assertNotEquals(null, errorButton); |
| 396 expectFalse(errorButton.disabled); | 396 expectFalse(errorButton.disabled); |
| 397 var errorText = $('error-text'); | 397 var errorText = $('error-text'); |
| 398 assertNotEquals(null, errorText); | 398 assertNotEquals(null, errorText); |
| 399 expectFalse(errorText.classList.contains('hidden')); | 399 expectFalse(errorText.classList.contains('hidden')); |
| 400 }); | 400 }); |
| 401 |
| 402 /** |
| 403 * Test fixture to test case when no PDF plugin exists. |
| 404 * @extends {PrintPreviewWebUITest} |
| 405 * @constructor |
| 406 **/ |
| 407 function PrintPreviewPrintCloseWebUITest() {} |
| 408 |
| 409 PrintPreviewPrintCloseWebUITest.prototype = { |
| 410 __proto__: PrintPreviewWebUITest.prototype, |
| 411 |
| 412 /** |
| 413 * Open a page, which does window.print(); window.close(); |
| 414 * @type {?string} |
| 415 * @override |
| 416 **/ |
| 417 browsePrintPreload: 'print_preview_print_close_test.html', |
| 418 |
| 419 /** |
| 420 * Indicate to browsertest not to print because the page will contain |
| 421 * JavaScript to window.print(). |
| 422 * @type {boolean} |
| 423 **/ |
| 424 noPrint: true, |
| 425 |
| 426 /** |
| 427 * Provide a typedef for C++ to correspond to JS subclass. |
| 428 * @type {?string} |
| 429 * @override |
| 430 **/ |
| 431 typedefCppFixture: 'PrintPreviewWebUITest', |
| 432 }; |
| 433 |
| 434 // Test that window.print(); window.close() still works with cancel. |
| 435 TEST_F('PrintPreviewPrintCloseWebUITest', 'TestPrintCloseCancel', function() { |
| 436 assertTrue(true); |
| 437 this.mockHandler.expects(once()).closePrintPreviewTab(). |
| 438 will(callFunction(function() { |
| 439 window.close(); |
| 440 })); |
| 441 |
| 442 $('cancel-button').click(); |
| 443 }); |
| OLD | NEW |