| 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 19 matching lines...) Expand all Loading... |
| 30 console.info('preLoad'); | 30 console.info('preLoad'); |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * Create a handler class with empty methods to allow mocking to register | 33 * Create a handler class with empty methods to allow mocking to register |
| 34 * expectations and for registration of handlers with chrome.send. | 34 * expectations and for registration of handlers with chrome.send. |
| 35 * @constructor | 35 * @constructor |
| 36 */ | 36 */ |
| 37 function MockPrintPreviewHandler() {} | 37 function MockPrintPreviewHandler() {} |
| 38 | 38 |
| 39 MockPrintPreviewHandler.prototype = { | 39 MockPrintPreviewHandler.prototype = { |
| 40 getDefaultPrinter: function() {}, | 40 getInitialSettings: function() {}, |
| 41 getPrinters: function() {}, | 41 getPrinters: function() {}, |
| 42 getPreview: function(settings, draft_page_count, modifiable) {}, | 42 getPreview: function(settings, draft_page_count, modifiable) {}, |
| 43 print: function(settings) {}, | 43 print: function(settings) {}, |
| 44 getPrinterCapabilities: function(printerName) {}, | 44 getPrinterCapabilities: function(printerName) {}, |
| 45 showSystemDialog: function() {}, | 45 showSystemDialog: function() {}, |
| 46 morePrinters: function() {}, | 46 morePrinters: function() {}, |
| 47 signIn: function() {}, | 47 signIn: function() {}, |
| 48 addCloudPrinter: function() {}, | 48 addCloudPrinter: function() {}, |
| 49 manageCloudPrinters: function() {}, | 49 manageCloudPrinters: function() {}, |
| 50 manageLocalPrinters: function() {}, | 50 manageLocalPrinters: function() {}, |
| 51 closePrintPreviewTab: function() {}, | 51 closePrintPreviewTab: function() {}, |
| 52 hidePreview: function() {}, | 52 hidePreview: function() {}, |
| 53 cancelPendingPrintRequest: function() {}, | 53 cancelPendingPrintRequest: function() {}, |
| 54 saveLastPrinter: function(name, cloud_print_data) {}, | 54 saveLastPrinter: function(name, cloud_print_data) {}, |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // Create the actual mock and register stubs for methods expected to be | 57 // Create the actual mock and register stubs for methods expected to be |
| 58 // called before tests run. Specific expectations can be made in the | 58 // called before tests run. Specific expectations can be made in the |
| 59 // tests themselves. | 59 // tests themselves. |
| 60 var mockHandler = this.mockHandler = mock(MockPrintPreviewHandler); | 60 var mockHandler = this.mockHandler = mock(MockPrintPreviewHandler); |
| 61 mockHandler.stubs().getDefaultPrinter(). | 61 mockHandler.stubs().getInitialSettings(). |
| 62 will(callFunction(function() { | 62 will(callFunction(function() { |
| 63 setDefaultPrinter('FooDevice'); | 63 setDefaultPrinter('FooDevice'); |
| 64 })); | 64 })); |
| 65 mockHandler.stubs().getPrinterCapabilities(NOT_NULL). | 65 mockHandler.stubs().getPrinterCapabilities(NOT_NULL). |
| 66 will(callFunction(function() { | 66 will(callFunction(function() { |
| 67 updateWithPrinterCapabilities({ | 67 updateWithPrinterCapabilities({ |
| 68 disableColorOption: true, | 68 disableColorOption: true, |
| 69 setColorAsDefault: true, | 69 setColorAsDefault: true, |
| 70 disableCopiesOption: true, | 70 disableCopiesOption: true, |
| 71 printerDefaultDuplexValue: copiesSettings.SIMPLEX, | 71 printerDefaultDuplexValue: copiesSettings.SIMPLEX, |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 442 |
| 443 // Test that error message is displayed when plugin doesn't exist. | 443 // Test that error message is displayed when plugin doesn't exist. |
| 444 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { | 444 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { |
| 445 var errorButton = $('error-button'); | 445 var errorButton = $('error-button'); |
| 446 assertNotEquals(null, errorButton); | 446 assertNotEquals(null, errorButton); |
| 447 expectFalse(errorButton.disabled); | 447 expectFalse(errorButton.disabled); |
| 448 var errorText = $('custom-message'); | 448 var errorText = $('custom-message'); |
| 449 assertNotEquals(null, errorText); | 449 assertNotEquals(null, errorText); |
| 450 expectFalse(errorText.hidden); | 450 expectFalse(errorText.hidden); |
| 451 }); | 451 }); |
| OLD | NEW |