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 GEN('#include "base/feature_list.h"'); | 5 GEN('#include "base/feature_list.h"'); |
6 GEN('#include "chrome/common/chrome_features.h"'); | 6 GEN('#include "chrome/common/chrome_features.h"'); |
7 | 7 |
8 /** | 8 /** |
9 * Test fixture for print preview WebUI testing. | 9 * Test fixture for print preview WebUI testing. |
10 * @constructor | 10 * @constructor |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 is_default: true | 512 is_default: true |
513 } | 513 } |
514 ] | 514 ] |
515 } | 515 } |
516 } | 516 } |
517 } | 517 } |
518 }; | 518 }; |
519 this.setCapabilities(device); | 519 this.setCapabilities(device); |
520 | 520 |
521 var otherOptions = $('other-options-settings'); | 521 var otherOptions = $('other-options-settings'); |
522 checkSectionVisible(otherOptions, false); | 522 checkSectionVisible(otherOptions, true); |
| 523 checkElementDisplayed( |
| 524 otherOptions.querySelector('#fit-to-page-container'), false); |
| 525 checkElementDisplayed( |
| 526 otherOptions.querySelector('#rasterize-container'), true); |
523 checkSectionVisible($('media-size-settings'), false); | 527 checkSectionVisible($('media-size-settings'), false); |
524 checkSectionVisible($('scaling-settings'), false); | 528 checkSectionVisible($('scaling-settings'), false); |
525 | 529 |
526 testDone(); | 530 testDone(); |
527 }); | 531 }); |
528 | 532 |
529 // When the source is 'HTML', we always hide the fit to page option and show | 533 // When the source is 'HTML', we always hide the fit to page option and show |
530 // media size option. | 534 // media size option. |
531 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { | 535 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { |
532 this.setInitialSettings(); | 536 this.setInitialSettings(); |
533 this.setLocalDestinations(); | 537 this.setLocalDestinations(); |
534 this.setCapabilities(getCddTemplate("FooDevice")); | 538 this.setCapabilities(getCddTemplate("FooDevice")); |
535 | 539 |
536 var otherOptions = $('other-options-settings'); | 540 var otherOptions = $('other-options-settings'); |
537 var fitToPage = otherOptions.querySelector('#fit-to-page-container'); | 541 var fitToPage = otherOptions.querySelector('#fit-to-page-container'); |
| 542 var rasterize = otherOptions.querySelector('#rasterize-container'); |
538 var mediaSize = $('media-size-settings'); | 543 var mediaSize = $('media-size-settings'); |
539 var scalingSettings = $('scaling-settings'); | 544 var scalingSettings = $('scaling-settings'); |
540 | 545 |
541 // Check that options are collapsed (section is visible, because duplex is | 546 // Check that options are collapsed (section is visible, because duplex is |
542 // available). | 547 // available). |
543 checkSectionVisible(otherOptions, true); | 548 checkSectionVisible(otherOptions, true); |
544 checkElementDisplayed(fitToPage, false); | 549 checkElementDisplayed(fitToPage, false); |
| 550 checkElementDisplayed(rasterize, false); |
545 checkSectionVisible(mediaSize, false); | 551 checkSectionVisible(mediaSize, false); |
546 checkSectionVisible(scalingSettings, false); | 552 checkSectionVisible(scalingSettings, false); |
547 | 553 |
548 this.expandMoreSettings(); | 554 this.expandMoreSettings(); |
549 | 555 |
550 checkElementDisplayed(fitToPage, false); | 556 checkElementDisplayed(fitToPage, false); |
| 557 checkElementDisplayed(rasterize, false); |
551 checkSectionVisible(mediaSize, true); | 558 checkSectionVisible(mediaSize, true); |
552 checkSectionVisible(scalingSettings, true); | 559 checkSectionVisible(scalingSettings, true); |
553 | 560 |
554 this.waitForAnimationToEnd('more-settings'); | 561 this.waitForAnimationToEnd('more-settings'); |
555 }); | 562 }); |
556 | 563 |
557 // When the source is "PDF", depending on the selected destination printer, we | 564 // When the source is "PDF", depending on the selected destination printer, we |
558 // show/hide the fit to page option and hide media size selection. | 565 // show/hide the fit to page option and hide media size selection. |
559 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() { | 566 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() { |
560 this.initialSettings_.isDocumentModifiable_ = false; | 567 this.initialSettings_.isDocumentModifiable_ = false; |
561 this.setInitialSettings(); | 568 this.setInitialSettings(); |
562 this.setLocalDestinations(); | 569 this.setLocalDestinations(); |
563 this.setCapabilities(getCddTemplate("FooDevice")); | 570 this.setCapabilities(getCddTemplate("FooDevice")); |
564 | 571 |
565 var otherOptions = $('other-options-settings'); | 572 var otherOptions = $('other-options-settings'); |
566 var scalingSettings = $('scaling-settings'); | 573 var scalingSettings = $('scaling-settings'); |
567 var fitToPageContainer = | 574 var fitToPageContainer = |
568 otherOptions.querySelector('#fit-to-page-container'); | 575 otherOptions.querySelector('#fit-to-page-container'); |
| 576 var rasterizeContainer = |
| 577 otherOptions.querySelector('#rasterize-container'); |
569 | 578 |
570 checkSectionVisible(otherOptions, true); | 579 checkSectionVisible(otherOptions, true); |
571 checkElementDisplayed(fitToPageContainer, true); | 580 checkElementDisplayed(fitToPageContainer, true); |
| 581 checkElementDisplayed(rasterizeContainer, false); |
572 expectTrue( | 582 expectTrue( |
573 fitToPageContainer.querySelector('.checkbox').checked); | 583 fitToPageContainer.querySelector('.checkbox').checked); |
574 this.expandMoreSettings(); | 584 this.expandMoreSettings(); |
| 585 checkElementDisplayed(rasterizeContainer, true); |
| 586 expectFalse( |
| 587 rasterizeContainer.querySelector('.checkbox').checked); |
575 checkSectionVisible($('media-size-settings'), true); | 588 checkSectionVisible($('media-size-settings'), true); |
576 checkSectionVisible(scalingSettings, true); | 589 checkSectionVisible(scalingSettings, true); |
577 | 590 |
578 this.waitForAnimationToEnd('other-options-collapsible'); | 591 this.waitForAnimationToEnd('other-options-collapsible'); |
579 }); | 592 }); |
580 | 593 |
581 // When the source is "PDF", depending on the selected destination printer, we | 594 // When the source is "PDF", depending on the selected destination printer, we |
582 // show/hide the fit to page option and hide media size selection. | 595 // show/hide the fit to page option and hide media size selection. |
583 TEST_F('PrintPreviewWebUITest', 'ScalingUnchecksFitToPage', function() { | 596 TEST_F('PrintPreviewWebUITest', 'ScalingUnchecksFitToPage', function() { |
584 this.initialSettings_.isDocumentModifiable_ = false; | 597 this.initialSettings_.isDocumentModifiable_ = false; |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 // appears. | 1224 // appears. |
1212 var advancedSettingsCloseButton = $('advanced-settings'). | 1225 var advancedSettingsCloseButton = $('advanced-settings'). |
1213 querySelector('.close-button'); | 1226 querySelector('.close-button'); |
1214 checkElementDisplayed(advancedSettingsCloseButton, true); | 1227 checkElementDisplayed(advancedSettingsCloseButton, true); |
1215 checkElementDisplayed($('advanced-settings'). | 1228 checkElementDisplayed($('advanced-settings'). |
1216 querySelector('.search-box-area'), true); | 1229 querySelector('.search-box-area'), true); |
1217 | 1230 |
1218 this.waitForAnimationToEnd('more-settings'); | 1231 this.waitForAnimationToEnd('more-settings'); |
1219 }); | 1232 }); |
1220 | 1233 |
OLD | NEW |