Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: chrome/test/data/webui/print_preview.js

Issue 556363003: Print Preview UI tweaks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust browser_tests accordingly. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/print_preview/settings/more_settings.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 var localDestsSetEvent = 424 var localDestsSetEvent =
425 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); 425 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET);
426 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; 426 localDestsSetEvent.destinationInfos = this.localDestinationInfos_;
427 this.nativeLayer_.dispatchEvent(localDestsSetEvent); 427 this.nativeLayer_.dispatchEvent(localDestsSetEvent);
428 428
429 var capsSetEvent = 429 var capsSetEvent =
430 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); 430 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET);
431 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); 431 capsSetEvent.settingsInfo = getCddTemplate("FooDevice");
432 this.nativeLayer_.dispatchEvent(capsSetEvent); 432 this.nativeLayer_.dispatchEvent(capsSetEvent);
433 433
434 var moreSettingsDiv = $('more-settings');
435 var otherOptionsDiv = $('other-options-settings'); 434 var otherOptionsDiv = $('other-options-settings');
436 435
437 // Check that options are collapsed (section is visible, because duplex is
438 // available).
439 checkSectionVisible(otherOptionsDiv, true); 436 checkSectionVisible(otherOptionsDiv, true);
440 checkElementDisplayed( 437 checkElementDisplayed(
441 otherOptionsDiv.querySelector('.fit-to-page-container'), false);
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); 438 otherOptionsDiv.querySelector('.fit-to-page-container'), true);
449 expectTrue( 439 expectTrue(
450 otherOptionsDiv.querySelector('.fit-to-page-checkbox').checked); 440 otherOptionsDiv.querySelector('.fit-to-page-checkbox').checked);
451 checkSectionVisible($('media-size-settings'), true); 441 checkSectionVisible($('media-size-settings'), true);
452 }); 442 });
453 443
454 // When the print scaling is disabled for the source "PDF", we show the fit 444 // When the print scaling is disabled for the source "PDF", we show the fit
455 // to page option but the state is unchecked by default. 445 // to page option but the state is unchecked by default.
456 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { 446 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() {
457 this.initialSettings_.isDocumentModifiable_ = false; 447 this.initialSettings_.isDocumentModifiable_ = false;
(...skipping 10 matching lines...) Expand all
468 458
469 var capsSetEvent = 459 var capsSetEvent =
470 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); 460 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET);
471 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); 461 capsSetEvent.settingsInfo = getCddTemplate("FooDevice");
472 this.nativeLayer_.dispatchEvent(capsSetEvent); 462 this.nativeLayer_.dispatchEvent(capsSetEvent);
473 463
474 // Indicate that the PDF does not support scaling by default. 464 // Indicate that the PDF does not support scaling by default.
475 cr.dispatchSimpleEvent( 465 cr.dispatchSimpleEvent(
476 this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING); 466 this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING);
477 467
478 var moreSettingsDiv = $('more-settings');
479 var otherOptionsDiv = $('other-options-settings'); 468 var otherOptionsDiv = $('other-options-settings');
480 469
481 // Check that options are collapsed (section is visible, because duplex is
482 // available).
483 checkSectionVisible(otherOptionsDiv, true); 470 checkSectionVisible(otherOptionsDiv, true);
484 // Expand it.
485 checkSectionVisible(moreSettingsDiv, true);
486 moreSettingsDiv.click();
487 471
488 checkElementDisplayed( 472 checkElementDisplayed(
489 otherOptionsDiv.querySelector('.fit-to-page-container'), true); 473 otherOptionsDiv.querySelector('.fit-to-page-container'), true);
490 expectFalse( 474 expectFalse(
491 otherOptionsDiv.querySelector('.fit-to-page-checkbox').checked); 475 otherOptionsDiv.querySelector('.fit-to-page-checkbox').checked);
492 }); 476 });
493 477
494 // Make sure that custom margins controls are properly set up. 478 // Make sure that custom margins controls are properly set up.
495 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { 479 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() {
496 var initialSettingsSetEvent = 480 var initialSettingsSetEvent =
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 expectEquals(true, previewFailedMessageEl.hidden); 925 expectEquals(true, previewFailedMessageEl.hidden);
942 926
943 var printFailedMessageEl = 927 var printFailedMessageEl =
944 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; 928 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0];
945 expectEquals(true, printFailedMessageEl.hidden); 929 expectEquals(true, printFailedMessageEl.hidden);
946 930
947 var customMessageEl = 931 var customMessageEl =
948 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; 932 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0];
949 expectEquals(false, customMessageEl.hidden); 933 expectEquals(false, customMessageEl.hidden);
950 }); 934 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/settings/more_settings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698