| 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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 this.waitForAnimationToEnd('other-options-collapsible'); | 764 this.waitForAnimationToEnd('other-options-collapsible'); |
| 765 }); | 765 }); |
| 766 | 766 |
| 767 // Make sure that custom margins controls are properly set up. | 767 // Make sure that custom margins controls are properly set up. |
| 768 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { | 768 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { |
| 769 this.setInitialSettings(); | 769 this.setInitialSettings(); |
| 770 this.setLocalDestinations(); | 770 this.setLocalDestinations(); |
| 771 this.setCapabilities(getCddTemplate("FooDevice")); | 771 this.setCapabilities(getCddTemplate("FooDevice")); |
| 772 | 772 |
| 773 printPreview.printTicketStore_.marginsType.updateValue( | 773 printPreview.printTicketStore_.marginsType.updateValue( |
| 774 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 774 print_preview.ticket_items.MarginsTypeValue.CUSTOM); |
| 775 | 775 |
| 776 ['left', 'top', 'right', 'bottom'].forEach(function(margin) { | 776 ['left', 'top', 'right', 'bottom'].forEach(function(margin) { |
| 777 var control = $('preview-area').querySelector('.margin-control-' + margin); | 777 var control = $('preview-area').querySelector('.margin-control-' + margin); |
| 778 assertNotEquals(null, control); | 778 assertNotEquals(null, control); |
| 779 var input = control.querySelector('.margin-control-textbox'); | 779 var input = control.querySelector('.margin-control-textbox'); |
| 780 assertTrue(input.hasAttribute('aria-label')); | 780 assertTrue(input.hasAttribute('aria-label')); |
| 781 assertNotEquals('undefined', input.getAttribute('aria-label')); | 781 assertNotEquals('undefined', input.getAttribute('aria-label')); |
| 782 }); | 782 }); |
| 783 this.waitForAnimationToEnd('more-settings'); | 783 this.waitForAnimationToEnd('more-settings'); |
| 784 }); | 784 }); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 796 // Check that options are collapsed (section is visible, because duplex is | 796 // Check that options are collapsed (section is visible, because duplex is |
| 797 // available). | 797 // available). |
| 798 checkSectionVisible(otherOptions, true); | 798 checkSectionVisible(otherOptions, true); |
| 799 checkElementDisplayed(headerFooter, false); | 799 checkElementDisplayed(headerFooter, false); |
| 800 | 800 |
| 801 this.expandMoreSettings(); | 801 this.expandMoreSettings(); |
| 802 | 802 |
| 803 checkElementDisplayed(headerFooter, true); | 803 checkElementDisplayed(headerFooter, true); |
| 804 | 804 |
| 805 printPreview.printTicketStore_.marginsType.updateValue( | 805 printPreview.printTicketStore_.marginsType.updateValue( |
| 806 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 806 print_preview.ticket_items.MarginsTypeValue.CUSTOM); |
| 807 printPreview.printTicketStore_.customMargins.updateValue( | 807 printPreview.printTicketStore_.customMargins.updateValue( |
| 808 new print_preview.Margins(0, 0, 0, 0)); | 808 new print_preview.Margins(0, 0, 0, 0)); |
| 809 | 809 |
| 810 checkElementDisplayed(headerFooter, false); | 810 checkElementDisplayed(headerFooter, false); |
| 811 | 811 |
| 812 this.waitForAnimationToEnd('more-settings'); | 812 this.waitForAnimationToEnd('more-settings'); |
| 813 }); | 813 }); |
| 814 | 814 |
| 815 // Page layout has half-inch margins. Show header and footer option. | 815 // Page layout has half-inch margins. Show header and footer option. |
| 816 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter', | 816 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter', |
| 817 function() { | 817 function() { |
| 818 this.setInitialSettings(); | 818 this.setInitialSettings(); |
| 819 this.setLocalDestinations(); | 819 this.setLocalDestinations(); |
| 820 this.setCapabilities(getCddTemplate("FooDevice")); | 820 this.setCapabilities(getCddTemplate("FooDevice")); |
| 821 | 821 |
| 822 var otherOptions = $('other-options-settings'); | 822 var otherOptions = $('other-options-settings'); |
| 823 var headerFooter = otherOptions.querySelector('#header-footer-container'); | 823 var headerFooter = otherOptions.querySelector('#header-footer-container'); |
| 824 | 824 |
| 825 // Check that options are collapsed (section is visible, because duplex is | 825 // Check that options are collapsed (section is visible, because duplex is |
| 826 // available). | 826 // available). |
| 827 checkSectionVisible(otherOptions, true); | 827 checkSectionVisible(otherOptions, true); |
| 828 checkElementDisplayed(headerFooter, false); | 828 checkElementDisplayed(headerFooter, false); |
| 829 | 829 |
| 830 this.expandMoreSettings(); | 830 this.expandMoreSettings(); |
| 831 | 831 |
| 832 checkElementDisplayed(headerFooter, true); | 832 checkElementDisplayed(headerFooter, true); |
| 833 | 833 |
| 834 printPreview.printTicketStore_.marginsType.updateValue( | 834 printPreview.printTicketStore_.marginsType.updateValue( |
| 835 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 835 print_preview.ticket_items.MarginsTypeValue.CUSTOM); |
| 836 printPreview.printTicketStore_.customMargins.updateValue( | 836 printPreview.printTicketStore_.customMargins.updateValue( |
| 837 new print_preview.Margins(36, 36, 36, 36)); | 837 new print_preview.Margins(36, 36, 36, 36)); |
| 838 | 838 |
| 839 checkElementDisplayed(headerFooter, true); | 839 checkElementDisplayed(headerFooter, true); |
| 840 | 840 |
| 841 this.waitForAnimationToEnd('more-settings'); | 841 this.waitForAnimationToEnd('more-settings'); |
| 842 }); | 842 }); |
| 843 | 843 |
| 844 // Page layout has zero top and bottom margins. Hide header and footer option. | 844 // Page layout has zero top and bottom margins. Hide header and footer option. |
| 845 TEST_F('PrintPreviewWebUITest', | 845 TEST_F('PrintPreviewWebUITest', |
| 846 'ZeroTopAndBottomMarginsHideHeaderFooter', | 846 'ZeroTopAndBottomMarginsHideHeaderFooter', |
| 847 function() { | 847 function() { |
| 848 this.setInitialSettings(); | 848 this.setInitialSettings(); |
| 849 this.setLocalDestinations(); | 849 this.setLocalDestinations(); |
| 850 this.setCapabilities(getCddTemplate("FooDevice")); | 850 this.setCapabilities(getCddTemplate("FooDevice")); |
| 851 | 851 |
| 852 var otherOptions = $('other-options-settings'); | 852 var otherOptions = $('other-options-settings'); |
| 853 var headerFooter = otherOptions.querySelector('#header-footer-container'); | 853 var headerFooter = otherOptions.querySelector('#header-footer-container'); |
| 854 | 854 |
| 855 // Check that options are collapsed (section is visible, because duplex is | 855 // Check that options are collapsed (section is visible, because duplex is |
| 856 // available). | 856 // available). |
| 857 checkSectionVisible(otherOptions, true); | 857 checkSectionVisible(otherOptions, true); |
| 858 checkElementDisplayed(headerFooter, false); | 858 checkElementDisplayed(headerFooter, false); |
| 859 | 859 |
| 860 this.expandMoreSettings(); | 860 this.expandMoreSettings(); |
| 861 | 861 |
| 862 checkElementDisplayed(headerFooter, true); | 862 checkElementDisplayed(headerFooter, true); |
| 863 | 863 |
| 864 printPreview.printTicketStore_.marginsType.updateValue( | 864 printPreview.printTicketStore_.marginsType.updateValue( |
| 865 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 865 print_preview.ticket_items.MarginsTypeValue.CUSTOM); |
| 866 printPreview.printTicketStore_.customMargins.updateValue( | 866 printPreview.printTicketStore_.customMargins.updateValue( |
| 867 new print_preview.Margins(0, 36, 0, 36)); | 867 new print_preview.Margins(0, 36, 0, 36)); |
| 868 | 868 |
| 869 checkElementDisplayed(headerFooter, false); | 869 checkElementDisplayed(headerFooter, false); |
| 870 | 870 |
| 871 this.waitForAnimationToEnd('more-settings'); | 871 this.waitForAnimationToEnd('more-settings'); |
| 872 }); | 872 }); |
| 873 | 873 |
| 874 // Page layout has zero top and half-inch bottom margin. Show header and footer | 874 // Page layout has zero top and half-inch bottom margin. Show header and footer |
| 875 // option. | 875 // option. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 886 // Check that options are collapsed (section is visible, because duplex is | 886 // Check that options are collapsed (section is visible, because duplex is |
| 887 // available). | 887 // available). |
| 888 checkSectionVisible(otherOptions, true); | 888 checkSectionVisible(otherOptions, true); |
| 889 checkElementDisplayed(headerFooter, false); | 889 checkElementDisplayed(headerFooter, false); |
| 890 | 890 |
| 891 this.expandMoreSettings(); | 891 this.expandMoreSettings(); |
| 892 | 892 |
| 893 checkElementDisplayed(headerFooter, true); | 893 checkElementDisplayed(headerFooter, true); |
| 894 | 894 |
| 895 printPreview.printTicketStore_.marginsType.updateValue( | 895 printPreview.printTicketStore_.marginsType.updateValue( |
| 896 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 896 print_preview.ticket_items.MarginsTypeValue.CUSTOM); |
| 897 printPreview.printTicketStore_.customMargins.updateValue( | 897 printPreview.printTicketStore_.customMargins.updateValue( |
| 898 new print_preview.Margins(0, 36, 36, 36)); | 898 new print_preview.Margins(0, 36, 36, 36)); |
| 899 | 899 |
| 900 checkElementDisplayed(headerFooter, true); | 900 checkElementDisplayed(headerFooter, true); |
| 901 | 901 |
| 902 this.waitForAnimationToEnd('more-settings'); | 902 this.waitForAnimationToEnd('more-settings'); |
| 903 }); | 903 }); |
| 904 | 904 |
| 905 // Check header footer availability with small (label) page size. | 905 // Check header footer availability with small (label) page size. |
| 906 TEST_F('PrintPreviewWebUITest', 'SmallPaperSizeHeaderFooter', function() { | 906 TEST_F('PrintPreviewWebUITest', 'SmallPaperSizeHeaderFooter', function() { |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 this.dispatchPreviewDone(); | 1442 this.dispatchPreviewDone(); |
| 1443 | 1443 |
| 1444 // Has active print button and successfully "prints", indicating recovery | 1444 // Has active print button and successfully "prints", indicating recovery |
| 1445 // from error state. | 1445 // from error state. |
| 1446 expectFalse(printButton.disabled); | 1446 expectFalse(printButton.disabled); |
| 1447 expectFalse(this.hasPrinted()); | 1447 expectFalse(this.hasPrinted()); |
| 1448 printButton.click(); | 1448 printButton.click(); |
| 1449 expectTrue(this.hasPrinted()); | 1449 expectTrue(this.hasPrinted()); |
| 1450 testDone(); | 1450 testDone(); |
| 1451 }); | 1451 }); |
| OLD | NEW |