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

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

Issue 2885363003: Add policy to use system default printer (Closed)
Patch Set: Fix dynamic refresh Created 3 years, 6 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
OLDNEW
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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 // Change the page range - no new draft needed. 1330 // Change the page range - no new draft needed.
1331 printPreview.printTicketStore_.pageRange.updateValue('2'); 1331 printPreview.printTicketStore_.pageRange.updateValue('2');
1332 expectFalse(nativeLayer.generateDraft()); 1332 expectFalse(nativeLayer.generateDraft());
1333 1333
1334 // Change the margin type - need to regenerate again. 1334 // Change the margin type - need to regenerate again.
1335 printPreview.printTicketStore_.marginsType.updateValue( 1335 printPreview.printTicketStore_.marginsType.updateValue(
1336 print_preview.ticket_items.MarginsTypeValue.NO_MARGINS); 1336 print_preview.ticket_items.MarginsTypeValue.NO_MARGINS);
1337 expectTrue(nativeLayer.generateDraft()); 1337 expectTrue(nativeLayer.generateDraft());
1338 }); 1338 });
1339 }); 1339 });
1340
1341 // Test that the policy to use the system default printer by default
1342 // instead of the most recently used destination works.
1343 test('SystemDefaultPrinterPolicy', function() {
1344 // Add recent destination.
1345 initialSettings.serializedAppStateStr_ = JSON.stringify({
1346 version: 2,
1347 recentDestinations: [
1348 {
1349 id: 'ID1',
1350 origin: cr.isChromeOS ? 'chrome_os' : 'local',
1351 account: '',
1352 capabilities: 0,
1353 name: 'One',
1354 extensionId: '',
1355 extensionName: '',
1356 },
1357 ],
1358 });
1359
1360 // Setup local destinations with the system default + recent.
1361 localDestinationInfos = [
1362 { printerName: 'One', deviceName: 'ID1' },
1363 { printerName: 'FooName', deviceName: 'FooDevice' }
1364 ];
1365 nativeLayer.setLocalDestinationCapabilities(
1366 getCddTemplate('ID1', 'One'));
1367
1368 return setupSettingsAndDestinationsWithCapabilities().then(function() {
1369 // The system default destination should be used instead of the
1370 // most recent destination.
1371 assertEquals(
1372 'FooDevice',
1373 printPreview.destinationStore_.selectedDestination.id);
1374 });
1375 });
1340 }); 1376 });
1341 }); 1377 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698