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

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

Issue 1368013004: Define Print Preview default printer selection policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tags to DefaultPrinterSelection policy. Created 5 years, 2 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 (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 * @constructor 7 * @constructor
8 * @extends {testing.Test} 8 * @extends {testing.Test}
9 */ 9 */
10 function PrintPreviewWebUITest() { 10 function PrintPreviewWebUITest() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 preLoad: function() { 63 preLoad: function() {
64 window.addEventListener('DOMContentLoaded', function() { 64 window.addEventListener('DOMContentLoaded', function() {
65 function NativeLayerStub() { 65 function NativeLayerStub() {
66 cr.EventTarget.call(this); 66 cr.EventTarget.call(this);
67 } 67 }
68 NativeLayerStub.prototype = { 68 NativeLayerStub.prototype = {
69 __proto__: cr.EventTarget.prototype, 69 __proto__: cr.EventTarget.prototype,
70 startGetInitialSettings: function() {}, 70 startGetInitialSettings: function() {},
71 startGetLocalDestinations: function() {}, 71 startGetLocalDestinations: function() {},
72 startGetPrivetDestinations: function() {}, 72 startGetPrivetDestinations: function() {},
73 startGetExtensionDestinations: function() {},
73 startGetLocalDestinationCapabilities: function(destinationId) {} 74 startGetLocalDestinationCapabilities: function(destinationId) {}
74 }; 75 };
75 var oldNativeLayerEventType = print_preview.NativeLayer.EventType; 76 var oldNativeLayerEventType = print_preview.NativeLayer.EventType;
76 var oldDuplexMode = print_preview.NativeLayer.DuplexMode; 77 var oldDuplexMode = print_preview.NativeLayer.DuplexMode;
77 print_preview.NativeLayer = NativeLayerStub; 78 print_preview.NativeLayer = NativeLayerStub;
78 print_preview.NativeLayer.EventType = oldNativeLayerEventType; 79 print_preview.NativeLayer.EventType = oldNativeLayerEventType;
79 print_preview.NativeLayer.DuplexMode = oldDuplexMode; 80 print_preview.NativeLayer.DuplexMode = oldDuplexMode;
80 81
81 function CloudPrintInterfaceStub() { 82 function CloudPrintInterfaceStub() {
82 cr.EventTarget.call(this); 83 cr.EventTarget.call(this);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 false /*hidePrintWithSystemDialogLink*/, 174 false /*hidePrintWithSystemDialogLink*/,
174 ',' /*thousandsDelimeter*/, 175 ',' /*thousandsDelimeter*/,
175 '.' /*decimalDelimeter*/, 176 '.' /*decimalDelimeter*/,
176 1 /*unitType*/, 177 1 /*unitType*/,
177 true /*isDocumentModifiable*/, 178 true /*isDocumentModifiable*/,
178 'title' /*documentTitle*/, 179 'title' /*documentTitle*/,
179 true /*documentHasSelection*/, 180 true /*documentHasSelection*/,
180 false /*selectionOnly*/, 181 false /*selectionOnly*/,
181 'FooDevice' /*systemDefaultDestinationId*/, 182 'FooDevice' /*systemDefaultDestinationId*/,
182 null /*serializedAppStateStr*/, 183 null /*serializedAppStateStr*/,
183 false /*documentHasSelection*/); 184 null /*serializedDefaultDestinationSelectionRulesStr*/);
184 this.localDestinationInfos_ = [ 185 this.localDestinationInfos_ = [
185 { printerName: 'FooName', deviceName: 'FooDevice' }, 186 { printerName: 'FooName', deviceName: 'FooDevice' },
186 { printerName: 'BarName', deviceName: 'BarDevice' } 187 { printerName: 'BarName', deviceName: 'BarDevice' }
187 ]; 188 ];
188 this.nativeLayer_ = printPreview.nativeLayer_; 189 this.nativeLayer_ = printPreview.nativeLayer_;
189 190
190 testing.Test.disableAnimationsAndTransitions(); 191 testing.Test.disableAnimationsAndTransitions();
191 } 192 }
192 }; 193 };
193 194
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreLocalDestination', 332 TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreLocalDestination',
332 function() { 333 function() {
333 this.initialSettings_.serializedAppStateStr_ = 334 this.initialSettings_.serializedAppStateStr_ =
334 '{"version":2,"selectedDestinationId":"ID",' + 335 '{"version":2,"selectedDestinationId":"ID",' +
335 '"selectedDestinationOrigin":"local"}'; 336 '"selectedDestinationOrigin":"local"}';
336 this.setInitialSettings(); 337 this.setInitialSettings();
337 338
338 testDone(); 339 testDone();
339 }); 340 });
340 341
342 TEST_F('PrintPreviewWebUITest',
343 'TestPrintPreviewDefaultDestinationSelectionRules', function() {
344 // It also makes sure these rules do override system default destination.
345 this.initialSettings_.serializedDefaultDestinationSelectionRulesStr_ =
346 '{"namePattern":".*Bar.*"}';
347 this.setInitialSettings();
348 this.setLocalDestinations();
349
350 assertEquals(
351 'BarDevice', printPreview.destinationStore_.selectedDestination.id);
352
353 testDone();
354 });
355
341 TEST_F('PrintPreviewWebUITest', 'TestSystemDialogLinkIsHiddenInAppKioskMode', 356 TEST_F('PrintPreviewWebUITest', 'TestSystemDialogLinkIsHiddenInAppKioskMode',
342 function() { 357 function() {
343 if (cr.isChromeOS) { 358 if (cr.isChromeOS) {
344 assertEquals(null, $('system-dialog-link')); 359 assertEquals(null, $('system-dialog-link'));
345 } else { 360 } else {
346 this.initialSettings_.isInAppKioskMode_ = true; 361 this.initialSettings_.isInAppKioskMode_ = true;
347 this.setInitialSettings(); 362 this.setInitialSettings();
348 363
349 checkElementDisplayed($('system-dialog-link'), false); 364 checkElementDisplayed($('system-dialog-link'), false);
350 } 365 }
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 expectEquals( 944 expectEquals(
930 customLocalizedMediaName, 945 customLocalizedMediaName,
931 mediaSelect.options[mediaSelect.selectedIndex].text); 946 mediaSelect.options[mediaSelect.selectedIndex].text);
932 // Check the other media item. 947 // Check the other media item.
933 expectEquals( 948 expectEquals(
934 customMediaName, 949 customMediaName,
935 mediaSelect.options[mediaSelect.selectedIndex == 0 ? 1 : 0].text); 950 mediaSelect.options[mediaSelect.selectedIndex == 0 ? 1 : 0].text);
936 951
937 this.waitForAnimationToEnd('more-settings'); 952 this.waitForAnimationToEnd('more-settings');
938 }); 953 });
OLDNEW
« no previous file with comments | « chrome/test/data/policy/policy_test_cases.json ('k') | components/policy/resources/policy_templates.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698