Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 cr.define('print_preview_test', function() { | 5 cr.define('print_preview_test', function() { |
| 6 /** | 6 /** |
| 7 * Index of the "Save as PDF" printer. | 7 * Index of the "Save as PDF" printer. |
| 8 * @type {number} | 8 * @type {number} |
| 9 * @const | 9 * @const |
| 10 */ | 10 */ |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1302 // Dispatch event indicating new preview has loaded. | 1302 // Dispatch event indicating new preview has loaded. |
| 1303 var previewDoneEvent = new Event( | 1303 var previewDoneEvent = new Event( |
| 1304 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_DONE); | 1304 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_DONE); |
| 1305 previewArea.dispatchEvent(previewDoneEvent); | 1305 previewArea.dispatchEvent(previewDoneEvent); |
| 1306 | 1306 |
| 1307 // Has active print button and successfully 'prints', indicating | 1307 // Has active print button and successfully 'prints', indicating |
| 1308 // recovery from error state. | 1308 // recovery from error state. |
| 1309 expectFalse(printButton.disabled); | 1309 expectFalse(printButton.disabled); |
| 1310 printButton.click(); | 1310 printButton.click(); |
| 1311 // This should result in a call to print. | 1311 // This should result in a call to print. |
| 1312 return nativeLayer.whenCalled('print'); | 1312 return nativeLayer.whenCalled('print').then( |
| 1313 /** | |
| 1314 * @param {destination: !print_preview.Destination, | |
| 1315 * printTicketStore: !print_preview.PrintTicketStore, | |
| 1316 * cloudPrintInterface: print_preview | |
| 1317 * .CloudPrintInterface, | |
| 1318 * documentInfo: print_preview.DocumentInfo} args | |
| 1319 * The arguments that print() was called with. | |
| 1320 */ | |
| 1321 function(args) { | |
| 1322 // Sanity check some printing argument values. | |
| 1323 var printTicketStore = args.printTicketStore; | |
| 1324 expectEquals(args.destination.id, 'BarDevice'); | |
| 1325 expectEquals(printTicketStore.landscape.getValue(), false); | |
| 1326 expectEquals(printTicketStore.copies.getValueAsNumber(), 1); | |
| 1327 expectEquals( | |
| 1328 printTicketStore.mediaSize.getValue().width_microns, | |
| 1329 215900); | |
|
dpapad
2017/06/27 18:49:00
Can we store the result of getCddTemplate() at lin
rbpotter
2017/06/28 01:14:57
Done.
| |
| 1330 expectEquals( | |
| 1331 printTicketStore.mediaSize.getValue().height_microns, | |
| 1332 279400); | |
| 1333 }); | |
| 1313 }); | 1334 }); |
| 1314 }); | 1335 }); |
| 1315 }); | 1336 }); |
| 1316 | 1337 |
| 1317 // Test the preview generator to make sure the generate draft parameter is | 1338 // Test the preview generator to make sure the generate draft parameter is |
| 1318 // set correctly. It should be false if the only change is the page range. | 1339 // set correctly. It should be false if the only change is the page range. |
| 1319 test('GenerateDraft', function() { | 1340 test('GenerateDraft', function() { |
| 1320 // Use a real preview generator. | 1341 // Use a real preview generator. |
| 1321 previewArea.previewGenerator_ = | 1342 previewArea.previewGenerator_ = |
| 1322 new print_preview.PreviewGenerator(printPreview.destinationStore_, | 1343 new print_preview.PreviewGenerator(printPreview.destinationStore_, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1368 return setupSettingsAndDestinationsWithCapabilities().then(function() { | 1389 return setupSettingsAndDestinationsWithCapabilities().then(function() { |
| 1369 // The system default destination should be used instead of the | 1390 // The system default destination should be used instead of the |
| 1370 // most recent destination. | 1391 // most recent destination. |
| 1371 assertEquals( | 1392 assertEquals( |
| 1372 'FooDevice', | 1393 'FooDevice', |
| 1373 printPreview.destinationStore_.selectedDestination.id); | 1394 printPreview.destinationStore_.selectedDestination.id); |
| 1374 }); | 1395 }); |
| 1375 }); | 1396 }); |
| 1376 }); | 1397 }); |
| 1377 }); | 1398 }); |
| OLD | NEW |