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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 /** @override */ | 52 /** @override */ |
53 runAccessibilityChecks: true, | 53 runAccessibilityChecks: true, |
54 | 54 |
55 /** @override */ | 55 /** @override */ |
56 accessibilityIssuesAreErrors: true, | 56 accessibilityIssuesAreErrors: true, |
57 | 57 |
58 /** @override */ | 58 /** @override */ |
59 isAsync: true, | 59 isAsync: true, |
60 | 60 |
61 /** | 61 /** |
62 * @override | |
63 */ | |
64 testGenPreamble: function() { | |
65 // Enable print as image for tests on non Windows/Mac. | |
66 GEN('#if !defined(OS_WINDOWS) && !defined(OS_MACOSX)'); | |
67 GEN(' base::FeatureList::ClearInstanceForTesting();'); | |
68 GEN(' std::unique_ptr<base::FeatureList>'); | |
69 GEN(' feature_list(new base::FeatureList);'); | |
70 GEN(' feature_list->InitializeFromCommandLine('); | |
71 GEN(' features::kPrintPdfAsImage.name, std::string());'); | |
72 GEN(' base::FeatureList::SetInstance(std::move(feature_list));'); | |
73 GEN('#endif'); | |
74 }, | |
75 | |
76 /** | |
77 * Stub out low-level functionality like the NativeLayer and | 62 * Stub out low-level functionality like the NativeLayer and |
78 * CloudPrintInterface. | 63 * CloudPrintInterface. |
79 * @this {PrintPreviewWebUITest} | 64 * @this {PrintPreviewWebUITest} |
80 * @override | 65 * @override |
81 */ | 66 */ |
82 preLoad: function() { | 67 preLoad: function() { |
83 window.addEventListener('DOMContentLoaded', function() { | 68 window.addEventListener('DOMContentLoaded', function() { |
84 function NativeLayerStub() { | 69 function NativeLayerStub() { |
85 cr.EventTarget.call(this); | 70 cr.EventTarget.call(this); |
86 this.printStarted_ = false; | 71 this.printStarted_ = false; |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 is_default: true | 399 is_default: true |
415 } | 400 } |
416 ] | 401 ] |
417 } | 402 } |
418 } | 403 } |
419 } | 404 } |
420 }; | 405 }; |
421 } | 406 } |
422 | 407 |
423 function isPrintAsImageEnabled() { | 408 function isPrintAsImageEnabled() { |
424 return !cr.isWindows && !cr.isMac; | 409 // Should be enabled by default on non Windows/Mac |
| 410 return (!cr.isWindows && !cr.isMac && |
| 411 loadTimeData.getBoolean('printPdfAsImageEnabled')); |
425 } | 412 } |
426 | 413 |
427 // Test restore settings with one destination. | 414 // Test restore settings with one destination. |
428 TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreLocalDestination', | 415 TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreLocalDestination', |
429 function() { | 416 function() { |
430 this.initialSettings_.serializedAppStateStr_ = | 417 this.initialSettings_.serializedAppStateStr_ = |
431 '{"version":2,"recentDestinations":[{"id":"ID", "origin":"local",' + | 418 '{"version":2,"recentDestinations":[{"id":"ID", "origin":"local",' + |
432 '"account":"", "capabilities":0, "name":"", "extensionId":"",' + | 419 '"account":"", "capabilities":0, "name":"", "extensionId":"",' + |
433 '"extensionName":""}]}'; | 420 '"extensionName":""}]}'; |
434 this.setInitialSettings(); | 421 this.setInitialSettings(); |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 printPreview.printTicketStore_.pageRange.updateValue("2"); | 1472 printPreview.printTicketStore_.pageRange.updateValue("2"); |
1486 expectFalse(this.generateDraft()); | 1473 expectFalse(this.generateDraft()); |
1487 | 1474 |
1488 // Change the margin type - need to regenerate again. | 1475 // Change the margin type - need to regenerate again. |
1489 printPreview.printTicketStore_.marginsType.updateValue( | 1476 printPreview.printTicketStore_.marginsType.updateValue( |
1490 print_preview.ticket_items.MarginsTypeValue.NO_MARGINS); | 1477 print_preview.ticket_items.MarginsTypeValue.NO_MARGINS); |
1491 expectTrue(this.generateDraft()); | 1478 expectTrue(this.generateDraft()); |
1492 | 1479 |
1493 testDone(); | 1480 testDone(); |
1494 }); | 1481 }); |
OLD | NEW |