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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 }); | |
OLD | NEW |