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

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

Issue 2833993004: Print Preview: Make generate draft mode work again. (Closed)
Patch Set: rebase Created 3 years, 7 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/ui/webui/print_preview/print_preview_handler.cc ('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 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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 // increments by 1 for each startGetPreview call it makes. It should only 1349 // increments by 1 for each startGetPreview call it makes. It should only
1350 // make one such call during initialization or there will be a race; see 1350 // make one such call during initialization or there will be a race; see
1351 // crbug.com/666595 1351 // crbug.com/666595
1352 expectEquals(printPreview.previewArea_.previewGenerator_.inFlightRequestId_, 1352 expectEquals(printPreview.previewArea_.previewGenerator_.inFlightRequestId_,
1353 -1); 1353 -1);
1354 this.setInitialSettings(); 1354 this.setInitialSettings();
1355 expectEquals(printPreview.previewArea_.previewGenerator_.inFlightRequestId_, 1355 expectEquals(printPreview.previewArea_.previewGenerator_.inFlightRequestId_,
1356 0); 1356 0);
1357 testDone(); 1357 testDone();
1358 }); 1358 });
1359
1360 // Test the preview generator to make sure the generate draft parameter is set
1361 // correctly. It should be false if the only change is the page range.
1362 TEST_F('PrintPreviewWebUITest', 'TestGenerateDraft', function() {
1363 // Use a real preview generator.
1364 printPreview.previewArea_.previewGenerator_ =
1365 new print_preview.PreviewGenerator(printPreview.destinationStore_,
1366 printPreview.printTicketStore_, this.nativeLayer_,
1367 printPreview.documentInfo_);
1368
1369 this.setInitialSettings();
1370 this.setLocalDestinations();
1371 this.setCapabilities(getCddTemplate("FooDevice"));
1372
1373 // The first request should set |generateDraft_| to true because there was no
1374 // previous print preview draft.
1375 expectEquals(
1376 0,
1377 printPreview.previewArea_.previewGenerator_.inFlightRequestId_);
1378 expectTrue(printPreview.previewArea_.previewGenerator_.generateDraft_);
dpapad 2017/05/01 18:08:31 Pasting my comment from another recent print previ
1379
1380 // Change the page range, and |generateDraft_| should be false.
1381 printPreview.printTicketStore_.pageRange.updateValue("2");
1382 expectEquals(
1383 1,
1384 printPreview.previewArea_.previewGenerator_.inFlightRequestId_);
1385 expectFalse(printPreview.previewArea_.previewGenerator_.generateDraft_);
1386
1387 // Change the margin type, and |generateDraft_| should be true.
1388 printPreview.printTicketStore_.marginsType.updateValue(
1389 print_preview.ticket_items.MarginsType.Value.NO_MARGINS);
1390 expectEquals(
1391 2,
1392 printPreview.previewArea_.previewGenerator_.inFlightRequestId_);
1393 expectTrue(printPreview.previewArea_.previewGenerator_.generateDraft_);
1394
1395 testDone();
1396 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698