| 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() {} |
| 11 | 11 |
| 12 PrintPreviewWebUITest.prototype = { | 12 PrintPreviewWebUITest.prototype = { |
| 13 __proto__: testing.Test.prototype, | 13 __proto__: testing.Test.prototype, |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Browse to the sample page, cause print preview & call preLoad(). | 16 * Browse to the sample page, cause print preview & call preLoad(). |
| 17 * @type {string} | 17 * @type {string} |
| 18 * @override | 18 * @override |
| 19 */ | 19 */ |
| 20 browsePrintPreload: 'print_preview_hello_world_test.html', | 20 browsePrintPreload: 'print_preview_hello_world_test.html', |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Register a mock handler to ensure expectations are met and print preview | 23 * Register a mock handler to ensure expectations are met and print preview |
| 24 * behaves correctly. | 24 * behaves correctly. |
| 25 * @type {Function} | 25 * @type {Function} |
| 26 * @override | 26 * @override |
| 27 */ | 27 */ |
| 28 preLoad: function() { | 28 preLoad: function() { |
| 29 this.makeAndRegisterMockHandler(['getDefaultPrinter', | 29 this.makeAndRegisterMockHandler(['getInitialSettings', |
| 30 'getPrinters', | 30 'getPrinters', |
| 31 'getPreview', | 31 'getPreview', |
| 32 'print', | 32 'print', |
| 33 'getPrinterCapabilities', | 33 'getPrinterCapabilities', |
| 34 'showSystemDialog', | 34 'showSystemDialog', |
| 35 'morePrinters', | 35 'morePrinters', |
| 36 'signIn', | 36 'signIn', |
| 37 'addCloudPrinter', | 37 'addCloudPrinter', |
| 38 'manageCloudPrinters', | 38 'manageCloudPrinters', |
| 39 'manageLocalPrinters', | 39 'manageLocalPrinters', |
| 40 'closePrintPreviewTab', | 40 'closePrintPreviewTab', |
| 41 'hidePreview', | 41 'hidePreview', |
| 42 'cancelPendingPrintRequest', | 42 'cancelPendingPrintRequest', |
| 43 'saveLastPrinter', | 43 'saveLastPrinter', |
| 44 ]); | 44 ]); |
| 45 | 45 |
| 46 // Register stubs for methods expected to be called before tests | 46 // Register stubs for methods expected to be called before tests |
| 47 // run. Specific expectations can be made in the tests themselves. | 47 // run. Specific expectations can be made in the tests themselves. |
| 48 this.mockHandler.stubs().getDefaultPrinter(). | 48 this.mockHandler.stubs().getInitialSettings(). |
| 49 will(callFunction(function() { | 49 will(callFunction(function() { |
| 50 setDefaultPrinter('FooDevice'); | 50 setDefaultPrinter('FooDevice'); |
| 51 })); | 51 })); |
| 52 this.mockHandler.stubs().getPrinterCapabilities(NOT_NULL). | 52 this.mockHandler.stubs().getPrinterCapabilities(NOT_NULL). |
| 53 will(callFunction(function() { | 53 will(callFunction(function() { |
| 54 updateWithPrinterCapabilities({ | 54 updateWithPrinterCapabilities({ |
| 55 disableColorOption: true, | 55 disableColorOption: true, |
| 56 setColorAsDefault: true, | 56 setColorAsDefault: true, |
| 57 disableCopiesOption: true, | 57 disableCopiesOption: true, |
| 58 printerDefaultDuplexValue: copiesSettings.SIMPLEX, | 58 printerDefaultDuplexValue: copiesSettings.SIMPLEX, |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 // Test that error message is displayed when plugin doesn't exist. | 414 // Test that error message is displayed when plugin doesn't exist. |
| 415 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { | 415 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { |
| 416 var errorButton = $('error-button'); | 416 var errorButton = $('error-button'); |
| 417 assertNotEquals(null, errorButton); | 417 assertNotEquals(null, errorButton); |
| 418 expectFalse(errorButton.disabled); | 418 expectFalse(errorButton.disabled); |
| 419 var errorText = $('custom-message'); | 419 var errorText = $('custom-message'); |
| 420 assertNotEquals(null, errorText); | 420 assertNotEquals(null, errorText); |
| 421 expectFalse(errorText.hidden); | 421 expectFalse(errorText.hidden); |
| 422 }); | 422 }); |
| OLD | NEW |