OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 }); | 263 }); |
264 })); | 264 })); |
265 | 265 |
266 updateControlsWithSelectedPrinterCapabilities(); | 266 updateControlsWithSelectedPrinterCapabilities(); |
267 | 267 |
268 checkSectionVisible(layoutSettings.layoutOption_, false); | 268 checkSectionVisible(layoutSettings.layoutOption_, false); |
269 checkSectionVisible(colorSettings.colorOption_, false); | 269 checkSectionVisible(colorSettings.colorOption_, false); |
270 checkSectionVisible(copiesSettings.copiesOption_, false); | 270 checkSectionVisible(copiesSettings.copiesOption_, false); |
271 }); | 271 }); |
272 | 272 |
273 TEST_F('PrintPreviewWebUITest', 'HeaderFooterSectionDisabled', function() { | |
274 // Case 1: Zero margin values. Hide header footer option. | |
dpapad
2012/03/14 21:15:17
Maybe these cases should be broken to independent
kmadhusu
2012/03/14 22:10:14
sure. Done.
| |
275 onDidGetDefaultPageLayout({ | |
276 contentWidth: 100, | |
277 contentHeight: 200, | |
278 marginLeft: 0, | |
279 marginRight: 0, | |
280 marginTop: 0, | |
281 marginBottom: 0}, true, false); | |
282 checkSectionVisible(headerFooterSettings.headerFooterOption_, false); | |
283 | |
284 // Case 2: Non-zero margins. Show header footer option. | |
285 onDidGetDefaultPageLayout({ | |
286 contentWidth: 100, | |
287 contentHeight: 200, | |
288 marginLeft: 10, | |
289 marginRight: 10, | |
290 marginTop: 10, | |
291 marginBottom: 10}, true, true); | |
292 checkSectionVisible(headerFooterSettings.headerFooterOption_, true); | |
293 | |
294 // Case 3: Zero top and bottom margins. Hide header footer option | |
295 onDidGetDefaultPageLayout({ | |
296 contentWidth: 100, | |
297 contentHeight: 200, | |
298 marginLeft: 10, | |
299 marginRight: 10, | |
300 marginTop: 0, | |
301 marginBottom: 0}, false, false); | |
302 checkSectionVisible(headerFooterSettings.headerFooterOption_, false); | |
303 }); | |
304 | |
273 // Test that the color settings are set according to the printer capabilities. | 305 // Test that the color settings are set according to the printer capabilities. |
274 TEST_F('PrintPreviewWebUITest', 'TestColorSettings', function() { | 306 TEST_F('PrintPreviewWebUITest', 'TestColorSettings', function() { |
275 this.mockHandler.expects(once()).getPrinterCapabilities('FooDevice'). | 307 this.mockHandler.expects(once()).getPrinterCapabilities('FooDevice'). |
276 will(callFunction(function() { | 308 will(callFunction(function() { |
277 updateWithPrinterCapabilities({ | 309 updateWithPrinterCapabilities({ |
278 disableColorOption: false, | 310 disableColorOption: false, |
279 setColorAsDefault: true, | 311 setColorAsDefault: true, |
280 disableCopiesOption: false, | 312 disableCopiesOption: false, |
281 disableLandscapeOption: false, | 313 disableLandscapeOption: false, |
282 printerDefaultDuplexValue: print_preview.CopiesSettings.SIMPLEX, | 314 printerDefaultDuplexValue: print_preview.CopiesSettings.SIMPLEX, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 | 441 |
410 // Test that error message is displayed when plugin doesn't exist. | 442 // Test that error message is displayed when plugin doesn't exist. |
411 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { | 443 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { |
412 var errorButton = $('error-button'); | 444 var errorButton = $('error-button'); |
413 assertNotEquals(null, errorButton); | 445 assertNotEquals(null, errorButton); |
414 expectFalse(errorButton.disabled); | 446 expectFalse(errorButton.disabled); |
415 var errorText = $('custom-message'); | 447 var errorText = $('custom-message'); |
416 assertNotEquals(null, errorText); | 448 assertNotEquals(null, errorText); |
417 expectFalse(errorText.hidden); | 449 expectFalse(errorText.hidden); |
418 }); | 450 }); |
OLD | NEW |