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 * @constructor | 7 * @constructor |
8 * @extends {testing.Test} | 8 * @extends {testing.Test} |
9 */ | 9 */ |
10 function PrintPreviewWebUITest() { | 10 function PrintPreviewWebUITest() { |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 var localDestsSetEvent = | 386 var localDestsSetEvent = |
387 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 387 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
388 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 388 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
389 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 389 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
390 | 390 |
391 var capsSetEvent = | 391 var capsSetEvent = |
392 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 392 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
393 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 393 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
394 this.nativeLayer_.dispatchEvent(capsSetEvent); | 394 this.nativeLayer_.dispatchEvent(capsSetEvent); |
395 | 395 |
396 checkElementDisplayed( | 396 var moreSettingsDiv = $('more-settings'); |
397 $('other-options-settings').querySelector('.fit-to-page-container'), | 397 var mediaSizeDiv = $('media-size-settings'); |
398 false); | 398 var otherOptionsDiv = $('other-options-settings'); |
399 checkSectionVisible($('media-size-settings'), true); | 399 var fitToPageEl = otherOptionsDiv.querySelector('.fit-to-page-container'); |
| 400 |
| 401 // Check that options are collapsed (section is visible, because duplex is |
| 402 // available). |
| 403 checkSectionVisible(otherOptionsDiv, true); |
| 404 checkElementDisplayed(fitToPageEl, false); |
| 405 checkSectionVisible(mediaSizeDiv, false); |
| 406 // Expand it. |
| 407 checkSectionVisible(moreSettingsDiv, true); |
| 408 moreSettingsDiv.click(); |
| 409 |
| 410 checkElementDisplayed(fitToPageEl, false); |
| 411 checkSectionVisible(mediaSizeDiv, true); |
400 }); | 412 }); |
401 | 413 |
402 // When the source is "PDF", depending on the selected destination printer, we | 414 // When the source is "PDF", depending on the selected destination printer, we |
403 // show/hide the fit to page option and hide media size selection. | 415 // show/hide the fit to page option and hide media size selection. |
404 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() { | 416 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() { |
405 this.initialSettings_.isDocumentModifiable_ = false; | 417 this.initialSettings_.isDocumentModifiable_ = false; |
406 | 418 |
407 var initialSettingsSetEvent = | 419 var initialSettingsSetEvent = |
408 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 420 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
409 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 421 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
410 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 422 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
411 | 423 |
412 var localDestsSetEvent = | 424 var localDestsSetEvent = |
413 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 425 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
414 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 426 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
415 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 427 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
416 | 428 |
417 var capsSetEvent = | 429 var capsSetEvent = |
418 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 430 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
419 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 431 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
420 this.nativeLayer_.dispatchEvent(capsSetEvent); | 432 this.nativeLayer_.dispatchEvent(capsSetEvent); |
421 | 433 |
| 434 var moreSettingsDiv = $('more-settings'); |
| 435 var otherOptionsDiv = $('other-options-settings'); |
| 436 |
| 437 // Check that options are collapsed (section is visible, because duplex is |
| 438 // available). |
| 439 checkSectionVisible(otherOptionsDiv, true); |
422 checkElementDisplayed( | 440 checkElementDisplayed( |
423 $('other-options-settings').querySelector('.fit-to-page-container'), | 441 otherOptionsDiv.querySelector('.fit-to-page-container'), false); |
424 true); | 442 checkSectionVisible($('media-size-settings'), false); |
| 443 // Expand it. |
| 444 checkSectionVisible(moreSettingsDiv, true); |
| 445 moreSettingsDiv.click(); |
| 446 |
| 447 checkElementDisplayed( |
| 448 otherOptionsDiv.querySelector('.fit-to-page-container'), true); |
425 expectTrue( | 449 expectTrue( |
426 $('other-options-settings').querySelector('.fit-to-page-checkbox'). | 450 otherOptionsDiv.querySelector('.fit-to-page-checkbox').checked); |
427 checked); | |
428 checkSectionVisible($('media-size-settings'), true); | 451 checkSectionVisible($('media-size-settings'), true); |
429 }); | 452 }); |
430 | 453 |
431 // When the print scaling is disabled for the source "PDF", we show the fit | 454 // When the print scaling is disabled for the source "PDF", we show the fit |
432 // to page option but the state is unchecked by default. | 455 // to page option but the state is unchecked by default. |
433 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { | 456 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { |
434 this.initialSettings_.isDocumentModifiable_ = false; | 457 this.initialSettings_.isDocumentModifiable_ = false; |
435 | 458 |
436 var initialSettingsSetEvent = | 459 var initialSettingsSetEvent = |
437 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 460 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
438 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 461 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
439 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 462 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
440 | 463 |
441 var localDestsSetEvent = | 464 var localDestsSetEvent = |
442 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 465 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
443 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 466 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
444 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 467 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
445 | 468 |
446 var capsSetEvent = | 469 var capsSetEvent = |
447 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 470 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
448 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 471 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
449 this.nativeLayer_.dispatchEvent(capsSetEvent); | 472 this.nativeLayer_.dispatchEvent(capsSetEvent); |
450 | 473 |
451 // Indicate that the PDF does not support scaling by default. | 474 // Indicate that the PDF does not support scaling by default. |
452 cr.dispatchSimpleEvent( | 475 cr.dispatchSimpleEvent( |
453 this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING); | 476 this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING); |
454 | 477 |
| 478 var moreSettingsDiv = $('more-settings'); |
| 479 var otherOptionsDiv = $('other-options-settings'); |
| 480 |
| 481 // Check that options are collapsed (section is visible, because duplex is |
| 482 // available). |
| 483 checkSectionVisible(otherOptionsDiv, true); |
| 484 // Expand it. |
| 485 checkSectionVisible(moreSettingsDiv, true); |
| 486 moreSettingsDiv.click(); |
| 487 |
455 checkElementDisplayed( | 488 checkElementDisplayed( |
456 $('other-options-settings').querySelector('.fit-to-page-container'), | 489 otherOptionsDiv.querySelector('.fit-to-page-container'), true); |
457 true); | |
458 expectFalse( | 490 expectFalse( |
459 $('other-options-settings').querySelector('.fit-to-page-checkbox'). | 491 otherOptionsDiv.querySelector('.fit-to-page-checkbox').checked); |
460 checked); | |
461 }); | 492 }); |
462 | 493 |
463 // Make sure that custom margins controls are properly set up. | 494 // Make sure that custom margins controls are properly set up. |
464 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { | 495 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { |
465 var initialSettingsSetEvent = | 496 var initialSettingsSetEvent = |
466 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 497 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
467 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 498 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
468 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 499 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
469 | 500 |
470 var localDestsSetEvent = | 501 var localDestsSetEvent = |
(...skipping 29 matching lines...) Expand all Loading... |
500 var localDestsSetEvent = | 531 var localDestsSetEvent = |
501 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 532 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
502 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 533 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
503 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 534 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
504 | 535 |
505 var capsSetEvent = | 536 var capsSetEvent = |
506 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 537 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
507 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 538 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
508 this.nativeLayer_.dispatchEvent(capsSetEvent); | 539 this.nativeLayer_.dispatchEvent(capsSetEvent); |
509 | 540 |
510 checkElementDisplayed( | 541 var moreSettingsDiv = $('more-settings'); |
511 $('other-options-settings').querySelector('.header-footer-container'), | 542 var otherOptionsDiv = $('other-options-settings'); |
512 true); | 543 var headerFooterEl = |
| 544 otherOptionsDiv.querySelector('.header-footer-container'); |
| 545 |
| 546 // Check that options are collapsed (section is visible, because duplex is |
| 547 // available). |
| 548 checkSectionVisible(otherOptionsDiv, true); |
| 549 checkElementDisplayed(headerFooterEl, false); |
| 550 // Expand it. |
| 551 checkSectionVisible(moreSettingsDiv, true); |
| 552 moreSettingsDiv.click(); |
| 553 |
| 554 checkElementDisplayed(headerFooterEl, true); |
513 | 555 |
514 printPreview.printTicketStore_.marginsType.updateValue( | 556 printPreview.printTicketStore_.marginsType.updateValue( |
515 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 557 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
516 printPreview.printTicketStore_.customMargins.updateValue( | 558 printPreview.printTicketStore_.customMargins.updateValue( |
517 new print_preview.Margins(0, 0, 0, 0)); | 559 new print_preview.Margins(0, 0, 0, 0)); |
518 | 560 |
519 checkElementDisplayed( | 561 checkElementDisplayed(headerFooterEl, false); |
520 $('other-options-settings').querySelector('.header-footer-container'), | |
521 false); | |
522 }); | 562 }); |
523 | 563 |
524 // Page layout has half-inch margins. Show header and footer option. | 564 // Page layout has half-inch margins. Show header and footer option. |
525 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter', | 565 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter', |
526 function() { | 566 function() { |
527 var initialSettingsSetEvent = | 567 var initialSettingsSetEvent = |
528 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 568 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
529 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 569 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
530 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 570 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
531 | 571 |
532 var localDestsSetEvent = | 572 var localDestsSetEvent = |
533 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 573 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
534 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 574 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
535 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 575 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
536 | 576 |
537 var capsSetEvent = | 577 var capsSetEvent = |
538 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 578 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
539 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 579 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
540 this.nativeLayer_.dispatchEvent(capsSetEvent); | 580 this.nativeLayer_.dispatchEvent(capsSetEvent); |
541 | 581 |
542 checkElementDisplayed( | 582 var moreSettingsDiv = $('more-settings'); |
543 $('other-options-settings').querySelector('.header-footer-container'), | 583 var otherOptionsDiv = $('other-options-settings'); |
544 true); | 584 var headerFooterEl = |
| 585 otherOptionsDiv.querySelector('.header-footer-container'); |
| 586 |
| 587 // Check that options are collapsed (section is visible, because duplex is |
| 588 // available). |
| 589 checkSectionVisible(otherOptionsDiv, true); |
| 590 checkElementDisplayed(headerFooterEl, false); |
| 591 // Expand it. |
| 592 checkSectionVisible(moreSettingsDiv, true); |
| 593 moreSettingsDiv.click(); |
| 594 |
| 595 checkElementDisplayed(headerFooterEl, true); |
545 | 596 |
546 printPreview.printTicketStore_.marginsType.updateValue( | 597 printPreview.printTicketStore_.marginsType.updateValue( |
547 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 598 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
548 printPreview.printTicketStore_.customMargins.updateValue( | 599 printPreview.printTicketStore_.customMargins.updateValue( |
549 new print_preview.Margins(36, 36, 36, 36)); | 600 new print_preview.Margins(36, 36, 36, 36)); |
550 | 601 |
551 checkElementDisplayed( | 602 checkElementDisplayed(headerFooterEl, true); |
552 $('other-options-settings').querySelector('.header-footer-container'), | |
553 true); | |
554 }); | 603 }); |
555 | 604 |
556 // Page layout has zero top and bottom margins. Hide header and footer option. | 605 // Page layout has zero top and bottom margins. Hide header and footer option. |
557 TEST_F('PrintPreviewWebUITest', | 606 TEST_F('PrintPreviewWebUITest', |
558 'ZeroTopAndBottomMarginsHideHeaderFooter', | 607 'ZeroTopAndBottomMarginsHideHeaderFooter', |
559 function() { | 608 function() { |
560 var initialSettingsSetEvent = | 609 var initialSettingsSetEvent = |
561 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 610 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
562 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 611 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
563 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 612 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
564 | 613 |
565 var localDestsSetEvent = | 614 var localDestsSetEvent = |
566 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 615 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
567 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 616 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
568 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 617 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
569 | 618 |
570 var capsSetEvent = | 619 var capsSetEvent = |
571 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 620 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
572 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 621 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
573 this.nativeLayer_.dispatchEvent(capsSetEvent); | 622 this.nativeLayer_.dispatchEvent(capsSetEvent); |
574 | 623 |
575 checkElementDisplayed( | 624 var moreSettingsDiv = $('more-settings'); |
576 $('other-options-settings').querySelector('.header-footer-container'), | 625 var otherOptionsDiv = $('other-options-settings'); |
577 true); | 626 var headerFooterEl = |
| 627 otherOptionsDiv.querySelector('.header-footer-container'); |
| 628 |
| 629 // Check that options are collapsed (section is visible, because duplex is |
| 630 // available). |
| 631 checkSectionVisible(otherOptionsDiv, true); |
| 632 checkElementDisplayed(headerFooterEl, false); |
| 633 // Expand it. |
| 634 checkSectionVisible(moreSettingsDiv, true); |
| 635 moreSettingsDiv.click(); |
| 636 |
| 637 checkElementDisplayed(headerFooterEl, true); |
578 | 638 |
579 printPreview.printTicketStore_.marginsType.updateValue( | 639 printPreview.printTicketStore_.marginsType.updateValue( |
580 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 640 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
581 printPreview.printTicketStore_.customMargins.updateValue( | 641 printPreview.printTicketStore_.customMargins.updateValue( |
582 new print_preview.Margins(0, 36, 0, 36)); | 642 new print_preview.Margins(0, 36, 0, 36)); |
583 | 643 |
584 checkElementDisplayed( | 644 checkElementDisplayed(headerFooterEl, false); |
585 $('other-options-settings').querySelector('.header-footer-container'), | |
586 false); | |
587 }); | 645 }); |
588 | 646 |
589 // Page layout has zero top and half-inch bottom margin. Show header and footer | 647 // Page layout has zero top and half-inch bottom margin. Show header and footer |
590 // option. | 648 // option. |
591 TEST_F('PrintPreviewWebUITest', | 649 TEST_F('PrintPreviewWebUITest', |
592 'ZeroTopAndNonZeroBottomMarginShowHeaderFooter', | 650 'ZeroTopAndNonZeroBottomMarginShowHeaderFooter', |
593 function() { | 651 function() { |
594 var initialSettingsSetEvent = | 652 var initialSettingsSetEvent = |
595 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 653 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
596 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 654 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
597 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 655 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
598 | 656 |
599 var localDestsSetEvent = | 657 var localDestsSetEvent = |
600 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 658 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
601 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 659 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
602 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 660 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
603 | 661 |
604 var capsSetEvent = | 662 var capsSetEvent = |
605 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 663 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
606 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 664 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
607 this.nativeLayer_.dispatchEvent(capsSetEvent); | 665 this.nativeLayer_.dispatchEvent(capsSetEvent); |
608 | 666 |
609 checkElementDisplayed( | 667 var moreSettingsDiv = $('more-settings'); |
610 $('other-options-settings').querySelector('.header-footer-container'), | 668 var otherOptionsDiv = $('other-options-settings'); |
611 true); | 669 var headerFooterEl = |
| 670 otherOptionsDiv.querySelector('.header-footer-container'); |
| 671 |
| 672 // Check that options are collapsed (section is visible, because duplex is |
| 673 // available). |
| 674 checkSectionVisible(otherOptionsDiv, true); |
| 675 checkElementDisplayed(headerFooterEl, false); |
| 676 // Expand it. |
| 677 checkSectionVisible(moreSettingsDiv, true); |
| 678 moreSettingsDiv.click(); |
| 679 |
| 680 checkElementDisplayed(headerFooterEl, true); |
612 | 681 |
613 printPreview.printTicketStore_.marginsType.updateValue( | 682 printPreview.printTicketStore_.marginsType.updateValue( |
614 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 683 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
615 printPreview.printTicketStore_.customMargins.updateValue( | 684 printPreview.printTicketStore_.customMargins.updateValue( |
616 new print_preview.Margins(0, 36, 36, 36)); | 685 new print_preview.Margins(0, 36, 36, 36)); |
617 | 686 |
618 checkElementDisplayed( | 687 checkElementDisplayed(headerFooterEl, true); |
619 $('other-options-settings').querySelector('.header-footer-container'), | |
620 true); | |
621 }); | 688 }); |
622 | 689 |
623 // Test that the color settings, one option, standard monochrome. | 690 // Test that the color settings, one option, standard monochrome. |
624 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsMonochrome', function() { | 691 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsMonochrome', function() { |
625 this.setUpPreview(); | 692 this.setUpPreview(); |
626 | 693 |
627 // Only one option, standard monochrome. | 694 // Only one option, standard monochrome. |
628 var capsSetEvent = | 695 var capsSetEvent = |
629 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 696 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
630 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 697 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 var initialSettingsSetEvent = | 855 var initialSettingsSetEvent = |
789 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 856 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
790 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 857 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
791 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 858 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
792 | 859 |
793 var localDestsSetEvent = | 860 var localDestsSetEvent = |
794 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 861 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
795 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 862 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
796 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 863 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
797 | 864 |
| 865 var moreSettingsDiv = $('more-settings'); |
798 var otherOptionsDiv = $('other-options-settings'); | 866 var otherOptionsDiv = $('other-options-settings'); |
799 var duplexDiv = otherOptionsDiv.querySelector('.duplex-container'); | 867 var duplexDiv = otherOptionsDiv.querySelector('.duplex-container'); |
800 | 868 |
801 var capsSetEvent = | 869 var capsSetEvent = |
802 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 870 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
803 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 871 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
804 delete capsSetEvent.settingsInfo.capabilities.printer.duplex; | 872 delete capsSetEvent.settingsInfo.capabilities.printer.duplex; |
805 this.nativeLayer_.dispatchEvent(capsSetEvent); | 873 this.nativeLayer_.dispatchEvent(capsSetEvent); |
806 | 874 |
| 875 // Check that it is collapsed. |
| 876 checkSectionVisible(otherOptionsDiv, false); |
| 877 // Expand it. |
| 878 checkSectionVisible(moreSettingsDiv, true); |
| 879 moreSettingsDiv.click(); |
| 880 // Now it should be visible. |
807 checkSectionVisible(otherOptionsDiv, true); | 881 checkSectionVisible(otherOptionsDiv, true); |
808 expectTrue(duplexDiv.hidden); | 882 expectTrue(duplexDiv.hidden); |
809 }); | 883 }); |
810 | 884 |
811 // Test that changing the selected printer updates the preview. | 885 // Test that changing the selected printer updates the preview. |
812 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { | 886 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { |
813 | 887 |
814 var initialSettingsSetEvent = | 888 var initialSettingsSetEvent = |
815 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 889 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
816 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 890 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 expectEquals(true, previewFailedMessageEl.hidden); | 939 expectEquals(true, previewFailedMessageEl.hidden); |
866 | 940 |
867 var printFailedMessageEl = | 941 var printFailedMessageEl = |
868 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; | 942 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; |
869 expectEquals(true, printFailedMessageEl.hidden); | 943 expectEquals(true, printFailedMessageEl.hidden); |
870 | 944 |
871 var customMessageEl = | 945 var customMessageEl = |
872 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; | 946 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; |
873 expectEquals(false, customMessageEl.hidden); | 947 expectEquals(false, customMessageEl.hidden); |
874 }); | 948 }); |
OLD | NEW |