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

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

Issue 9699040: PrintPreview: Hide/Show the header footer option based on print frame margins. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/print_web_view_helper_browsertest.cc ('k') | printing/print_job_constants.h » ('j') | 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 * @extends {testing.Test} 7 * @extends {testing.Test}
8 * @constructor 8 * @constructor
9 */ 9 */
10 function PrintPreviewWebUITest() {} 10 function PrintPreviewWebUITest() {}
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 }); 263 });
264 })); 264 }));
265 265
266 updateControlsWithSelectedPrinterCapabilities(); 266 updateControlsWithSelectedPrinterCapabilities();
267 267
268 checkSectionVisible(layoutSettings.layoutOption_, false); 268 checkSectionVisible(layoutSettings.layoutOption_, false);
269 checkSectionVisible(colorSettings.colorOption_, false); 269 checkSectionVisible(colorSettings.colorOption_, false);
270 checkSectionVisible(copiesSettings.copiesOption_, false); 270 checkSectionVisible(copiesSettings.copiesOption_, false);
271 }); 271 });
272 272
273 // Page layout has zero margins. Hide header and footer option.
274 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasNoMarginsHideHeaderFooter',
275 function() {
276 setInitialSettings({previewModifiable: true});
277 onDidGetDefaultPageLayout({
278 contentWidth: 100, contentHeight: 200, marginLeft: 0, marginRight: 0,
279 marginTop: 0, marginBottom: 0, printableAreaX: 0, printableAreaY: 0,
280 printableAreaWidth: 100, printableAreaHeight: 200}, true);
281 checkSectionVisible(headerFooterSettings.headerFooterOption_, false);
282 });
283
284 // Page layout has non-zero margins. Show header and footer option.
285 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter',
286 function() {
287 setInitialSettings({previewModifiable: true});
288 onDidGetDefaultPageLayout({
289 contentWidth: 100, contentHeight: 200, marginLeft: 3, marginRight: 2,
290 marginTop: 4, marginBottom: 1, printableAreaX: 1, printableAreaY: 1,
291 printableAreaWidth: 103, printableAreaHeight: 203}, true);
292 checkSectionVisible(headerFooterSettings.headerFooterOption_, true);
293 });
294
295 // Page layout has zero top and bottom margins. Hide header and footer option.
296 TEST_F('PrintPreviewWebUITest', 'ZeroTopAndBottomMarginsHideHeaderFooter',
297 function() {
298 setInitialSettings({previewModifiable: true});
299 onDidGetDefaultPageLayout({
300 contentWidth: 100, contentHeight: 200, marginLeft: 3, marginRight: 2,
301 marginTop: 0, marginBottom: 0, printableAreaX: 1, printableAreaY: 1,
302 printableAreaWidth: 98, printableAreaHeight: 198}, false);
303 checkSectionVisible(headerFooterSettings.headerFooterOption_, false);
304 });
305
306 // Page layout has zero top and non-zero bottom margin. Show header and footer
307 // option.
308 TEST_F('PrintPreviewWebUITest', 'ZeroTopAndNonZeroBottomMarginShowHeaderFooter',
309 function() {
310 setInitialSettings({previewModifiable: true});
311 onDidGetDefaultPageLayout({
312 contentWidth: 100, contentHeight: 200, marginLeft: 6, marginRight: 4,
313 marginTop: 0, marginBottom: 3, printableAreaX: 1, printableAreaY: 1,
314 printableAreaWidth: 103, printableAreaHeight: 208}, false);
315 checkSectionVisible(headerFooterSettings.headerFooterOption_, true);
316 });
317
273 // Test that the color settings are set according to the printer capabilities. 318 // Test that the color settings are set according to the printer capabilities.
274 TEST_F('PrintPreviewWebUITest', 'TestColorSettings', function() { 319 TEST_F('PrintPreviewWebUITest', 'TestColorSettings', function() {
275 this.mockHandler.expects(once()).getPrinterCapabilities('FooDevice'). 320 this.mockHandler.expects(once()).getPrinterCapabilities('FooDevice').
276 will(callFunction(function() { 321 will(callFunction(function() {
277 updateWithPrinterCapabilities({ 322 updateWithPrinterCapabilities({
278 disableColorOption: false, 323 disableColorOption: false,
279 setColorAsDefault: true, 324 setColorAsDefault: true,
280 disableCopiesOption: false, 325 disableCopiesOption: false,
281 disableLandscapeOption: false, 326 disableLandscapeOption: false,
282 printerDefaultDuplexValue: print_preview.CopiesSettings.SIMPLEX, 327 printerDefaultDuplexValue: print_preview.CopiesSettings.SIMPLEX,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 454
410 // Test that error message is displayed when plugin doesn't exist. 455 // Test that error message is displayed when plugin doesn't exist.
411 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { 456 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() {
412 var errorButton = $('error-button'); 457 var errorButton = $('error-button');
413 assertNotEquals(null, errorButton); 458 assertNotEquals(null, errorButton);
414 expectFalse(errorButton.disabled); 459 expectFalse(errorButton.disabled);
415 var errorText = $('custom-message'); 460 var errorText = $('custom-message');
416 assertNotEquals(null, errorText); 461 assertNotEquals(null, errorText);
417 expectFalse(errorText.hidden); 462 expectFalse(errorText.hidden);
418 }); 463 });
OLDNEW
« no previous file with comments | « chrome/renderer/print_web_view_helper_browsertest.cc ('k') | printing/print_job_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698