| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 height_microns: 0, | 511 height_microns: 0, |
| 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 checkSectionVisible($('other-options-settings'), false); | 521 var otherOptions = $('other-options-settings'); |
| 522 checkSectionVisible(otherOptions, false); |
| 522 checkSectionVisible($('media-size-settings'), false); | 523 checkSectionVisible($('media-size-settings'), false); |
| 523 checkSectionVisible($('scaling-settings'), false); | 524 checkSectionVisible($('scaling-settings'), false); |
| 524 | 525 |
| 525 testDone(); | 526 testDone(); |
| 526 }); | 527 }); |
| 527 | 528 |
| 528 // When the source is 'HTML', we always hide the fit to page option and show | 529 // When the source is 'HTML', we always hide the fit to page option and show |
| 529 // media size option. | 530 // media size option. |
| 530 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { | 531 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { |
| 531 this.setInitialSettings(); | 532 this.setInitialSettings(); |
| 532 this.setLocalDestinations(); | 533 this.setLocalDestinations(); |
| 533 this.setCapabilities(getCddTemplate("FooDevice")); | 534 this.setCapabilities(getCddTemplate("FooDevice")); |
| 534 | 535 |
| 535 var otherOptions = $('other-options-settings'); | 536 var otherOptions = $('other-options-settings'); |
| 536 var fitToPage = otherOptions.querySelector('.fit-to-page-container'); | 537 var fitToPage = otherOptions.querySelector('#fit-to-page-container'); |
| 537 var mediaSize = $('media-size-settings'); | 538 var mediaSize = $('media-size-settings'); |
| 538 var scalingSettings = $('scaling-settings'); | 539 var scalingSettings = $('scaling-settings'); |
| 539 | 540 |
| 540 // Check that options are collapsed (section is visible, because duplex is | 541 // Check that options are collapsed (section is visible, because duplex is |
| 541 // available). | 542 // available). |
| 542 checkSectionVisible(otherOptions, true); | 543 checkSectionVisible(otherOptions, true); |
| 543 checkElementDisplayed(fitToPage, false); | 544 checkElementDisplayed(fitToPage, false); |
| 544 checkSectionVisible(mediaSize, false); | 545 checkSectionVisible(mediaSize, false); |
| 545 checkSectionVisible(scalingSettings, false); | 546 checkSectionVisible(scalingSettings, false); |
| 546 | 547 |
| 547 this.expandMoreSettings(); | 548 this.expandMoreSettings(); |
| 548 | 549 |
| 549 checkElementDisplayed(fitToPage, false); | 550 checkElementDisplayed(fitToPage, false); |
| 550 checkSectionVisible(mediaSize, true); | 551 checkSectionVisible(mediaSize, true); |
| 551 checkSectionVisible(scalingSettings, true); | 552 checkSectionVisible(scalingSettings, true); |
| 552 | 553 |
| 553 this.waitForAnimationToEnd('more-settings'); | 554 this.waitForAnimationToEnd('more-settings'); |
| 554 }); | 555 }); |
| 555 | 556 |
| 556 // When the source is "PDF", depending on the selected destination printer, we | 557 // When the source is "PDF", depending on the selected destination printer, we |
| 557 // show/hide the fit to page option and hide media size selection. | 558 // show/hide the fit to page option and hide media size selection. |
| 558 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() { | 559 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() { |
| 559 this.initialSettings_.isDocumentModifiable_ = false; | 560 this.initialSettings_.isDocumentModifiable_ = false; |
| 560 this.setInitialSettings(); | 561 this.setInitialSettings(); |
| 561 this.setLocalDestinations(); | 562 this.setLocalDestinations(); |
| 562 this.setCapabilities(getCddTemplate("FooDevice")); | 563 this.setCapabilities(getCddTemplate("FooDevice")); |
| 563 | 564 |
| 564 var otherOptions = $('other-options-settings'); | 565 var otherOptions = $('other-options-settings'); |
| 565 var scalingSettings = $('scaling-settings'); | 566 var scalingSettings = $('scaling-settings'); |
| 567 var fitToPageContainer = |
| 568 otherOptions.querySelector('#fit-to-page-container'); |
| 566 | 569 |
| 567 checkSectionVisible(otherOptions, true); | 570 checkSectionVisible(otherOptions, true); |
| 568 checkElementDisplayed( | 571 checkElementDisplayed(fitToPageContainer, true); |
| 569 otherOptions.querySelector('.fit-to-page-container'), true); | |
| 570 expectTrue( | 572 expectTrue( |
| 571 otherOptions.querySelector('.fit-to-page-checkbox').checked); | 573 fitToPageContainer.querySelector('.checkbox').checked); |
| 572 this.expandMoreSettings(); | 574 this.expandMoreSettings(); |
| 573 checkSectionVisible($('media-size-settings'), true); | 575 checkSectionVisible($('media-size-settings'), true); |
| 574 checkSectionVisible(scalingSettings, true); | 576 checkSectionVisible(scalingSettings, true); |
| 575 | 577 |
| 576 this.waitForAnimationToEnd('other-options-collapsible'); | 578 this.waitForAnimationToEnd('other-options-collapsible'); |
| 577 }); | 579 }); |
| 578 | 580 |
| 579 // When the source is "PDF", depending on the selected destination printer, we | 581 // When the source is "PDF", depending on the selected destination printer, we |
| 580 // show/hide the fit to page option and hide media size selection. | 582 // show/hide the fit to page option and hide media size selection. |
| 581 TEST_F('PrintPreviewWebUITest', 'ScalingUnchecksFitToPage', function() { | 583 TEST_F('PrintPreviewWebUITest', 'ScalingUnchecksFitToPage', function() { |
| 582 this.initialSettings_.isDocumentModifiable_ = false; | 584 this.initialSettings_.isDocumentModifiable_ = false; |
| 583 this.setInitialSettings(); | 585 this.setInitialSettings(); |
| 584 this.setLocalDestinations(); | 586 this.setLocalDestinations(); |
| 585 this.setCapabilities(getCddTemplate("FooDevice")); | 587 this.setCapabilities(getCddTemplate("FooDevice")); |
| 586 | 588 |
| 587 var otherOptions = $('other-options-settings'); | 589 var otherOptions = $('other-options-settings'); |
| 588 var scalingSettings = $('scaling-settings'); | 590 var scalingSettings = $('scaling-settings'); |
| 589 | 591 |
| 590 checkSectionVisible(otherOptions, true); | 592 checkSectionVisible(otherOptions, true); |
| 591 checkElementDisplayed( | 593 var fitToPageContainer = |
| 592 otherOptions.querySelector('.fit-to-page-container'), true); | 594 otherOptions.querySelector('#fit-to-page-container'); |
| 595 checkElementDisplayed(fitToPageContainer, true); |
| 593 expectTrue( | 596 expectTrue( |
| 594 otherOptions.querySelector('.fit-to-page-checkbox').checked); | 597 fitToPageContainer.querySelector('.checkbox').checked); |
| 595 this.expandMoreSettings(); | 598 this.expandMoreSettings(); |
| 596 checkSectionVisible($('media-size-settings'), true); | 599 checkSectionVisible($('media-size-settings'), true); |
| 597 checkSectionVisible(scalingSettings, true); | 600 checkSectionVisible(scalingSettings, true); |
| 598 | 601 |
| 599 //Change scaling input | 602 //Change scaling input |
| 600 var scalingInput = scalingSettings.querySelector('.user-value'); | 603 var scalingInput = scalingSettings.querySelector('.user-value'); |
| 601 expectEquals(scalingInput.value, '100'); | 604 expectEquals(scalingInput.value, '100'); |
| 602 scalingInput.stepUp(5); | 605 scalingInput.stepUp(5); |
| 603 expectEquals(scalingInput.value, '105'); | 606 expectEquals(scalingInput.value, '105'); |
| 604 | 607 |
| 605 // Trigger the event | 608 // Trigger the event |
| 606 var enter = document.createEvent('Event'); | 609 var enter = document.createEvent('Event'); |
| 607 enter.initEvent('keydown'); | 610 enter.initEvent('keydown'); |
| 608 enter.keyCode = 'Enter'; | 611 enter.keyCode = 'Enter'; |
| 609 scalingInput.dispatchEvent(enter); | 612 scalingInput.dispatchEvent(enter); |
| 610 expectFalse( | 613 expectFalse( |
| 611 otherOptions.querySelector('.fit-to-page-checkbox').checked); | 614 fitToPageContainer.querySelector('.checkbox').checked); |
| 612 | 615 |
| 613 this.waitForAnimationToEnd('other-options-collapsible'); | 616 this.waitForAnimationToEnd('other-options-collapsible'); |
| 614 }); | 617 }); |
| 615 | 618 |
| 616 // When the number of copies print preset is set for source 'PDF', we update | 619 // When the number of copies print preset is set for source 'PDF', we update |
| 617 // the copies value if capability is supported by printer. | 620 // the copies value if capability is supported by printer. |
| 618 TEST_F('PrintPreviewWebUITest', 'CheckNumCopiesPrintPreset', function() { | 621 TEST_F('PrintPreviewWebUITest', 'CheckNumCopiesPrintPreset', function() { |
| 619 this.initialSettings_.isDocumentModifiable_ = false; | 622 this.initialSettings_.isDocumentModifiable_ = false; |
| 620 this.setInitialSettings(); | 623 this.setInitialSettings(); |
| 621 this.setLocalDestinations(); | 624 this.setLocalDestinations(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 651 var printPresetOptions = { | 654 var printPresetOptions = { |
| 652 duplex: 1 | 655 duplex: 1 |
| 653 }; | 656 }; |
| 654 var printPresetOptionsEvent = new Event( | 657 var printPresetOptionsEvent = new Event( |
| 655 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); | 658 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); |
| 656 printPresetOptionsEvent.optionsFromDocument = printPresetOptions; | 659 printPresetOptionsEvent.optionsFromDocument = printPresetOptions; |
| 657 this.nativeLayer_.dispatchEvent(printPresetOptionsEvent); | 660 this.nativeLayer_.dispatchEvent(printPresetOptionsEvent); |
| 658 | 661 |
| 659 var otherOptions = $('other-options-settings'); | 662 var otherOptions = $('other-options-settings'); |
| 660 checkSectionVisible(otherOptions, true); | 663 checkSectionVisible(otherOptions, true); |
| 661 checkElementDisplayed(otherOptions.querySelector('.duplex-container'), true); | 664 var duplexContainer = otherOptions.querySelector('#duplex-container'); |
| 662 expectTrue(otherOptions.querySelector('.duplex-checkbox').checked); | 665 checkElementDisplayed(duplexContainer, true); |
| 666 expectTrue(duplexContainer.querySelector('.checkbox').checked); |
| 663 | 667 |
| 664 this.waitForAnimationToEnd('other-options-collapsible'); | 668 this.waitForAnimationToEnd('other-options-collapsible'); |
| 665 }); | 669 }); |
| 666 | 670 |
| 667 // Make sure that custom margins controls are properly set up. | 671 // Make sure that custom margins controls are properly set up. |
| 668 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { | 672 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { |
| 669 this.setInitialSettings(); | 673 this.setInitialSettings(); |
| 670 this.setLocalDestinations(); | 674 this.setLocalDestinations(); |
| 671 this.setCapabilities(getCddTemplate("FooDevice")); | 675 this.setCapabilities(getCddTemplate("FooDevice")); |
| 672 | 676 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 684 }); | 688 }); |
| 685 | 689 |
| 686 // Page layout has zero margins. Hide header and footer option. | 690 // Page layout has zero margins. Hide header and footer option. |
| 687 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasNoMarginsHideHeaderFooter', | 691 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasNoMarginsHideHeaderFooter', |
| 688 function() { | 692 function() { |
| 689 this.setInitialSettings(); | 693 this.setInitialSettings(); |
| 690 this.setLocalDestinations(); | 694 this.setLocalDestinations(); |
| 691 this.setCapabilities(getCddTemplate("FooDevice")); | 695 this.setCapabilities(getCddTemplate("FooDevice")); |
| 692 | 696 |
| 693 var otherOptions = $('other-options-settings'); | 697 var otherOptions = $('other-options-settings'); |
| 694 var headerFooter = otherOptions.querySelector('.header-footer-container'); | 698 var headerFooter = otherOptions.querySelector('#header-footer-container'); |
| 695 | 699 |
| 696 // Check that options are collapsed (section is visible, because duplex is | 700 // Check that options are collapsed (section is visible, because duplex is |
| 697 // available). | 701 // available). |
| 698 checkSectionVisible(otherOptions, true); | 702 checkSectionVisible(otherOptions, true); |
| 699 checkElementDisplayed(headerFooter, false); | 703 checkElementDisplayed(headerFooter, false); |
| 700 | 704 |
| 701 this.expandMoreSettings(); | 705 this.expandMoreSettings(); |
| 702 | 706 |
| 703 checkElementDisplayed(headerFooter, true); | 707 checkElementDisplayed(headerFooter, true); |
| 704 | 708 |
| 705 printPreview.printTicketStore_.marginsType.updateValue( | 709 printPreview.printTicketStore_.marginsType.updateValue( |
| 706 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 710 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
| 707 printPreview.printTicketStore_.customMargins.updateValue( | 711 printPreview.printTicketStore_.customMargins.updateValue( |
| 708 new print_preview.Margins(0, 0, 0, 0)); | 712 new print_preview.Margins(0, 0, 0, 0)); |
| 709 | 713 |
| 710 checkElementDisplayed(headerFooter, false); | 714 checkElementDisplayed(headerFooter, false); |
| 711 | 715 |
| 712 this.waitForAnimationToEnd('more-settings'); | 716 this.waitForAnimationToEnd('more-settings'); |
| 713 }); | 717 }); |
| 714 | 718 |
| 715 // Page layout has half-inch margins. Show header and footer option. | 719 // Page layout has half-inch margins. Show header and footer option. |
| 716 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter', | 720 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter', |
| 717 function() { | 721 function() { |
| 718 this.setInitialSettings(); | 722 this.setInitialSettings(); |
| 719 this.setLocalDestinations(); | 723 this.setLocalDestinations(); |
| 720 this.setCapabilities(getCddTemplate("FooDevice")); | 724 this.setCapabilities(getCddTemplate("FooDevice")); |
| 721 | 725 |
| 722 var otherOptions = $('other-options-settings'); | 726 var otherOptions = $('other-options-settings'); |
| 723 var headerFooter = otherOptions.querySelector('.header-footer-container'); | 727 var headerFooter = otherOptions.querySelector('#header-footer-container'); |
| 724 | 728 |
| 725 // Check that options are collapsed (section is visible, because duplex is | 729 // Check that options are collapsed (section is visible, because duplex is |
| 726 // available). | 730 // available). |
| 727 checkSectionVisible(otherOptions, true); | 731 checkSectionVisible(otherOptions, true); |
| 728 checkElementDisplayed(headerFooter, false); | 732 checkElementDisplayed(headerFooter, false); |
| 729 | 733 |
| 730 this.expandMoreSettings(); | 734 this.expandMoreSettings(); |
| 731 | 735 |
| 732 checkElementDisplayed(headerFooter, true); | 736 checkElementDisplayed(headerFooter, true); |
| 733 | 737 |
| 734 printPreview.printTicketStore_.marginsType.updateValue( | 738 printPreview.printTicketStore_.marginsType.updateValue( |
| 735 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 739 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
| 736 printPreview.printTicketStore_.customMargins.updateValue( | 740 printPreview.printTicketStore_.customMargins.updateValue( |
| 737 new print_preview.Margins(36, 36, 36, 36)); | 741 new print_preview.Margins(36, 36, 36, 36)); |
| 738 | 742 |
| 739 checkElementDisplayed(headerFooter, true); | 743 checkElementDisplayed(headerFooter, true); |
| 740 | 744 |
| 741 this.waitForAnimationToEnd('more-settings'); | 745 this.waitForAnimationToEnd('more-settings'); |
| 742 }); | 746 }); |
| 743 | 747 |
| 744 // Page layout has zero top and bottom margins. Hide header and footer option. | 748 // Page layout has zero top and bottom margins. Hide header and footer option. |
| 745 TEST_F('PrintPreviewWebUITest', | 749 TEST_F('PrintPreviewWebUITest', |
| 746 'ZeroTopAndBottomMarginsHideHeaderFooter', | 750 'ZeroTopAndBottomMarginsHideHeaderFooter', |
| 747 function() { | 751 function() { |
| 748 this.setInitialSettings(); | 752 this.setInitialSettings(); |
| 749 this.setLocalDestinations(); | 753 this.setLocalDestinations(); |
| 750 this.setCapabilities(getCddTemplate("FooDevice")); | 754 this.setCapabilities(getCddTemplate("FooDevice")); |
| 751 | 755 |
| 752 var otherOptions = $('other-options-settings'); | 756 var otherOptions = $('other-options-settings'); |
| 753 var headerFooter = otherOptions.querySelector('.header-footer-container'); | 757 var headerFooter = otherOptions.querySelector('#header-footer-container'); |
| 754 | 758 |
| 755 // Check that options are collapsed (section is visible, because duplex is | 759 // Check that options are collapsed (section is visible, because duplex is |
| 756 // available). | 760 // available). |
| 757 checkSectionVisible(otherOptions, true); | 761 checkSectionVisible(otherOptions, true); |
| 758 checkElementDisplayed(headerFooter, false); | 762 checkElementDisplayed(headerFooter, false); |
| 759 | 763 |
| 760 this.expandMoreSettings(); | 764 this.expandMoreSettings(); |
| 761 | 765 |
| 762 checkElementDisplayed(headerFooter, true); | 766 checkElementDisplayed(headerFooter, true); |
| 763 | 767 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 774 // Page layout has zero top and half-inch bottom margin. Show header and footer | 778 // Page layout has zero top and half-inch bottom margin. Show header and footer |
| 775 // option. | 779 // option. |
| 776 TEST_F('PrintPreviewWebUITest', | 780 TEST_F('PrintPreviewWebUITest', |
| 777 'ZeroTopAndNonZeroBottomMarginShowHeaderFooter', | 781 'ZeroTopAndNonZeroBottomMarginShowHeaderFooter', |
| 778 function() { | 782 function() { |
| 779 this.setInitialSettings(); | 783 this.setInitialSettings(); |
| 780 this.setLocalDestinations(); | 784 this.setLocalDestinations(); |
| 781 this.setCapabilities(getCddTemplate("FooDevice")); | 785 this.setCapabilities(getCddTemplate("FooDevice")); |
| 782 | 786 |
| 783 var otherOptions = $('other-options-settings'); | 787 var otherOptions = $('other-options-settings'); |
| 784 var headerFooter = otherOptions.querySelector('.header-footer-container'); | 788 var headerFooter = otherOptions.querySelector('#header-footer-container'); |
| 785 | 789 |
| 786 // Check that options are collapsed (section is visible, because duplex is | 790 // Check that options are collapsed (section is visible, because duplex is |
| 787 // available). | 791 // available). |
| 788 checkSectionVisible(otherOptions, true); | 792 checkSectionVisible(otherOptions, true); |
| 789 checkElementDisplayed(headerFooter, false); | 793 checkElementDisplayed(headerFooter, false); |
| 790 | 794 |
| 791 this.expandMoreSettings(); | 795 this.expandMoreSettings(); |
| 792 | 796 |
| 793 checkElementDisplayed(headerFooter, true); | 797 checkElementDisplayed(headerFooter, true); |
| 794 | 798 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 | 952 |
| 949 // Test to verify that duplex settings are set according to the printer | 953 // Test to verify that duplex settings are set according to the printer |
| 950 // capabilities. | 954 // capabilities. |
| 951 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsTrue', function() { | 955 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsTrue', function() { |
| 952 this.setInitialSettings(); | 956 this.setInitialSettings(); |
| 953 this.setLocalDestinations(); | 957 this.setLocalDestinations(); |
| 954 this.setCapabilities(getCddTemplate("FooDevice")); | 958 this.setCapabilities(getCddTemplate("FooDevice")); |
| 955 | 959 |
| 956 var otherOptions = $('other-options-settings'); | 960 var otherOptions = $('other-options-settings'); |
| 957 checkSectionVisible(otherOptions, true); | 961 checkSectionVisible(otherOptions, true); |
| 958 expectFalse(otherOptions.querySelector('.duplex-container').hidden); | 962 duplexContainer = otherOptions.querySelector('#duplex-container'); |
| 959 expectFalse(otherOptions.querySelector('.duplex-checkbox').checked); | 963 expectFalse(duplexContainer.hidden); |
| 964 expectFalse(duplexContainer.querySelector('.checkbox').checked); |
| 960 | 965 |
| 961 this.waitForAnimationToEnd('more-settings'); | 966 this.waitForAnimationToEnd('more-settings'); |
| 962 }); | 967 }); |
| 963 | 968 |
| 964 // Test to verify that duplex settings are set according to the printer | 969 // Test to verify that duplex settings are set according to the printer |
| 965 // capabilities. | 970 // capabilities. |
| 966 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsFalse', function() { | 971 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsFalse', function() { |
| 967 this.setInitialSettings(); | 972 this.setInitialSettings(); |
| 968 this.setLocalDestinations(); | 973 this.setLocalDestinations(); |
| 969 var device = getCddTemplate("FooDevice"); | 974 var device = getCddTemplate("FooDevice"); |
| 970 delete device.capabilities.printer.duplex; | 975 delete device.capabilities.printer.duplex; |
| 971 this.setCapabilities(device); | 976 this.setCapabilities(device); |
| 972 | 977 |
| 973 // Check that it is collapsed. | 978 // Check that it is collapsed. |
| 974 var otherOptions = $('other-options-settings'); | 979 var otherOptions = $('other-options-settings'); |
| 975 checkSectionVisible(otherOptions, false); | 980 checkSectionVisible(otherOptions, false); |
| 976 | 981 |
| 977 this.expandMoreSettings(); | 982 this.expandMoreSettings(); |
| 978 | 983 |
| 979 // Now it should be visible. | 984 // Now it should be visible. |
| 980 checkSectionVisible(otherOptions, true); | 985 checkSectionVisible(otherOptions, true); |
| 981 expectTrue(otherOptions.querySelector('.duplex-container').hidden); | 986 expectTrue(otherOptions.querySelector('#duplex-container').hidden); |
| 982 | 987 |
| 983 this.waitForAnimationToEnd('more-settings'); | 988 this.waitForAnimationToEnd('more-settings'); |
| 984 }); | 989 }); |
| 985 | 990 |
| 986 // Test that changing the selected printer updates the preview. | 991 // Test that changing the selected printer updates the preview. |
| 987 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { | 992 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { |
| 988 this.setInitialSettings(); | 993 this.setInitialSettings(); |
| 989 this.setLocalDestinations(); | 994 this.setLocalDestinations(); |
| 990 this.setCapabilities(getCddTemplate("FooDevice")); | 995 this.setCapabilities(getCddTemplate("FooDevice")); |
| 991 | 996 |
| 992 var previewGenerator = mock(print_preview.PreviewGenerator); | 997 var previewGenerator = mock(print_preview.PreviewGenerator); |
| 993 printPreview.previewArea_.previewGenerator_ = previewGenerator.proxy(); | 998 printPreview.previewArea_.previewGenerator_ = previewGenerator.proxy(); |
| 994 | 999 |
| 995 // TODO (rbpotter): Figure out why this is 7 with the addition of scaling, | 1000 // The number of settings that can change due to a change in the destination |
| 996 // and if it is a problem. | 1001 // that will therefore dispatch ticket item change events. |
| 997 previewGenerator.expects(exactly(7)).requestPreview(); | 1002 previewGenerator.expects(exactly(7)).requestPreview(); |
| 998 | 1003 |
| 999 var barDestination; | 1004 var barDestination; |
| 1000 var destinations = printPreview.destinationStore_.destinations(); | 1005 var destinations = printPreview.destinationStore_.destinations(); |
| 1001 for (var destination, i = 0; destination = destinations[i]; i++) { | 1006 for (var destination, i = 0; destination = destinations[i]; i++) { |
| 1002 if (destination.id == 'BarDevice') { | 1007 if (destination.id == 'BarDevice') { |
| 1003 barDestination = destination; | 1008 barDestination = destination; |
| 1004 break; | 1009 break; |
| 1005 } | 1010 } |
| 1006 } | 1011 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 // appears. | 1211 // appears. |
| 1207 var advancedSettingsCloseButton = $('advanced-settings'). | 1212 var advancedSettingsCloseButton = $('advanced-settings'). |
| 1208 querySelector('.close-button'); | 1213 querySelector('.close-button'); |
| 1209 checkElementDisplayed(advancedSettingsCloseButton, true); | 1214 checkElementDisplayed(advancedSettingsCloseButton, true); |
| 1210 checkElementDisplayed($('advanced-settings'). | 1215 checkElementDisplayed($('advanced-settings'). |
| 1211 querySelector('.search-box-area'), true); | 1216 querySelector('.search-box-area'), true); |
| 1212 | 1217 |
| 1213 this.waitForAnimationToEnd('more-settings'); | 1218 this.waitForAnimationToEnd('more-settings'); |
| 1214 }); | 1219 }); |
| 1215 | 1220 |
| OLD | NEW |