| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 367 |
| 368 // Test that error message is displayed when plugin doesn't exist. | 368 // Test that error message is displayed when plugin doesn't exist. |
| 369 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { | 369 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { |
| 370 var errorButton = $('error-button'); | 370 var errorButton = $('error-button'); |
| 371 assertNotEquals(null, errorButton); | 371 assertNotEquals(null, errorButton); |
| 372 expectFalse(errorButton.disabled); | 372 expectFalse(errorButton.disabled); |
| 373 var errorText = $('error-text'); | 373 var errorText = $('error-text'); |
| 374 assertNotEquals(null, errorText); | 374 assertNotEquals(null, errorText); |
| 375 expectFalse(errorText.classList.contains('hidden')); | 375 expectFalse(errorText.classList.contains('hidden')); |
| 376 }); | 376 }); |
| 377 |
| 378 /** |
| 379 * Test fixture to test case when no PDF plugin exists. |
| 380 * @extends {PrintPreviewWebUITest} |
| 381 * @constructor |
| 382 **/ |
| 383 function PrintPreviewPrintCloseWebUITest() {} |
| 384 |
| 385 PrintPreviewPrintCloseWebUITest.prototype = { |
| 386 __proto__: PrintPreviewWebUITest.prototype, |
| 387 |
| 388 /** |
| 389 * Open a page, which does window.print(); window.close(); |
| 390 * @type {?string} |
| 391 * @override |
| 392 **/ |
| 393 browsePrintPreload: 'print_preview_print_close_test.html', |
| 394 |
| 395 /** |
| 396 * Indicate to browsertest not to print because the page will contain |
| 397 * JavaScript to window.print(). |
| 398 * @type {boolean} |
| 399 **/ |
| 400 noPrint: true, |
| 401 |
| 402 /** |
| 403 * Provide a typedef for C++ to correspond to JS subclass. |
| 404 * @type {?string} |
| 405 * @override |
| 406 **/ |
| 407 typedefCppFixture: 'PrintPreviewWebUITest', |
| 408 }; |
| 409 |
| 410 // Test that window.print(); window.close() still works with cancel. |
| 411 TEST_F('PrintPreviewPrintCloseWebUITest', 'TestPrintCloseCancel', function() { |
| 412 assertTrue(true); |
| 413 this.mockHandler.expects(once()).closePrintPreviewTab(). |
| 414 will(callFunction(function() { |
| 415 window.close(); |
| 416 })); |
| 417 |
| 418 $('cancel-button').click(); |
| 419 }); |
| OLD | NEW |