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 (function() { | 5 (function() { |
6 function MockHandler() { | 6 function MockHandler() { |
7 this.__proto__ = MockHandler.prototype; | 7 this.__proto__ = MockHandler.prototype; |
8 }; | 8 }; |
9 | 9 |
10 MockHandler.prototype = { | 10 MockHandler.prototype = { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 }; | 66 }; |
67 | 67 |
68 function verifyBasicPrintPreviewButtons(printEnabled) { | 68 function verifyBasicPrintPreviewButtons(printEnabled) { |
69 var printButton = $('print-button'); | 69 var printButton = $('print-button'); |
70 assertTrue(printButton != null); | 70 assertTrue(printButton != null); |
71 var cancelButton = $('cancel-button'); | 71 var cancelButton = $('cancel-button'); |
72 assertTrue(cancelButton != null); | 72 assertTrue(cancelButton != null); |
73 }; | 73 }; |
74 | 74 |
75 registerCallbacks(); | 75 if ('window' in this && 'registerCallbacks' in window) |
| 76 registerCallbacks(); |
76 | 77 |
77 internal = { | 78 internal = { |
78 'verifyBasicPrintPreviewButtons': verifyBasicPrintPreviewButtons, | 79 'verifyBasicPrintPreviewButtons': verifyBasicPrintPreviewButtons, |
79 }; | 80 }; |
80 })(); | 81 })(); |
81 | 82 |
82 // Tests. | 83 // Tests. |
83 function testPrintPreview(printEnabled) { | 84 function testPrintPreview(printEnabled) { |
84 internal.verifyBasicPrintPreviewButtons(printEnabled); | 85 internal.verifyBasicPrintPreviewButtons(printEnabled); |
85 var printer_list = $('printer-list'); | 86 var printer_list = $('printer-list'); |
86 assertTrue(printEnabled); | 87 assertTrue(printEnabled); |
87 assertTrue(printer_list.options.length >= 2); | 88 assertTrue(printer_list.options.length >= 2); |
88 assertEquals('FooName', printer_list.options[0].text); | 89 assertEquals('FooName', printer_list.options[0].text); |
89 assertEquals('FooDevice', printer_list.options[0].value); | 90 assertEquals('FooDevice', printer_list.options[0].value); |
90 assertEquals('BarName', printer_list.options[1].text); | 91 assertEquals('BarName', printer_list.options[1].text); |
91 assertEquals('BarDevice', printer_list.options[1].value); | 92 assertEquals('BarDevice', printer_list.options[1].value); |
92 } | 93 } |
OLD | NEW |