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 // Page layout has zero margins. Hide header and footer option. |
| 274 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasNoMarginsHideHeaderFooter', |
| 275 function() { |
| 276 onDidGetDefaultPageLayout({ |
| 277 contentWidth: 100, |
| 278 contentHeight: 200, |
| 279 marginLeft: 0, |
| 280 marginRight: 0, |
| 281 marginTop: 0, |
| 282 marginBottom: 0}, true, false); |
| 283 checkSectionVisible(headerFooterSettings.headerFooterOption_, false); |
| 284 }); |
| 285 |
| 286 // Page layout has non-zero margins. Show header and footer option. |
| 287 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter', |
| 288 function() { |
| 289 onDidGetDefaultPageLayout({ |
| 290 contentWidth: 100, |
| 291 contentHeight: 200, |
| 292 marginLeft: 3, |
| 293 marginRight: 2, |
| 294 marginTop: 4, |
| 295 marginBottom: 1}, true, true); |
| 296 checkSectionVisible(headerFooterSettings.headerFooterOption_, true); |
| 297 }); |
| 298 |
| 299 // Page layout has zero top and bottom margins. Hide header and footer option. |
| 300 TEST_F('PrintPreviewWebUITest', 'ZeroTopAndBottomMarginsHideHeaderFooter', |
| 301 function() { |
| 302 onDidGetDefaultPageLayout({ |
| 303 contentWidth: 100, |
| 304 contentHeight: 200, |
| 305 marginLeft: 3, |
| 306 marginRight: 2, |
| 307 marginTop: 0, |
| 308 marginBottom: 0}, false, false); |
| 309 checkSectionVisible(headerFooterSettings.headerFooterOption_, false); |
| 310 }); |
| 311 |
| 312 // Page layout has zero top and non-zero bottom margin. Show header and footer |
| 313 // option. |
| 314 TEST_F('PrintPreviewWebUITest', 'ZeroTopAndNonZeroBottomMarginShowHeaderFooter', |
| 315 function() { |
| 316 onDidGetDefaultPageLayout({ |
| 317 contentWidth: 100, |
| 318 contentHeight: 200, |
| 319 marginLeft: 6, |
| 320 marginRight: 4, |
| 321 marginTop: 0, |
| 322 marginBottom: 3}, false, true); |
| 323 checkSectionVisible(headerFooterSettings.headerFooterOption_, true); |
| 324 }); |
| 325 |
273 // Test that the color settings are set according to the printer capabilities. | 326 // Test that the color settings are set according to the printer capabilities. |
274 TEST_F('PrintPreviewWebUITest', 'TestColorSettings', function() { | 327 TEST_F('PrintPreviewWebUITest', 'TestColorSettings', function() { |
275 this.mockHandler.expects(once()).getPrinterCapabilities('FooDevice'). | 328 this.mockHandler.expects(once()).getPrinterCapabilities('FooDevice'). |
276 will(callFunction(function() { | 329 will(callFunction(function() { |
277 updateWithPrinterCapabilities({ | 330 updateWithPrinterCapabilities({ |
278 disableColorOption: false, | 331 disableColorOption: false, |
279 setColorAsDefault: true, | 332 setColorAsDefault: true, |
280 disableCopiesOption: false, | 333 disableCopiesOption: false, |
281 disableLandscapeOption: false, | 334 disableLandscapeOption: false, |
282 printerDefaultDuplexValue: print_preview.CopiesSettings.SIMPLEX, | 335 printerDefaultDuplexValue: print_preview.CopiesSettings.SIMPLEX, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 462 |
410 // Test that error message is displayed when plugin doesn't exist. | 463 // Test that error message is displayed when plugin doesn't exist. |
411 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { | 464 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { |
412 var errorButton = $('error-button'); | 465 var errorButton = $('error-button'); |
413 assertNotEquals(null, errorButton); | 466 assertNotEquals(null, errorButton); |
414 expectFalse(errorButton.disabled); | 467 expectFalse(errorButton.disabled); |
415 var errorText = $('custom-message'); | 468 var errorText = $('custom-message'); |
416 assertNotEquals(null, errorText); | 469 assertNotEquals(null, errorText); |
417 expectFalse(errorText.hidden); | 470 expectFalse(errorText.hidden); |
418 }); | 471 }); |
OLD | NEW |