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

Unified Diff: chrome/browser/resources/print_preview/native_layer.js

Issue 23054002: Added basic browser test for window.print() from Chrome apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added print preview auto-cancel to avoid test timeouts Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/native_layer.js
diff --git a/chrome/browser/resources/print_preview/native_layer.js b/chrome/browser/resources/print_preview/native_layer.js
index bda89a709ea50dee81146b91d68e56257de5e08d..93292e9e7191115e4829649ed56f8296ad5998f3 100644
--- a/chrome/browser/resources/print_preview/native_layer.js
+++ b/chrome/browser/resources/print_preview/native_layer.js
@@ -40,6 +40,8 @@ cr.define('print_preview', function() {
global['printScalingDisabledForSourcePDF'] =
this.onPrintScalingDisabledForSourcePDF_.bind(this);
global['onDidGetAccessToken'] = this.onDidGetAccessToken_.bind(this);
+ global['autoCancelPrintPreviewForTesting'] =
+ this.autoCancelPrintPreviewForTesting_.bind(this);
};
/**
@@ -49,6 +51,8 @@ cr.define('print_preview', function() {
*/
NativeLayer.EventType = {
ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY',
+ AUTO_CANCEL_FOR_TESTING:
+ 'print_preview.NativeLayer.AUTO_CANCEL_FOR_TESTING',
CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET',
CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE',
DESTINATIONS_RELOAD: 'print_preview.NativeLayer.DESTINATIONS_RELOAD',
@@ -577,6 +581,16 @@ cr.define('print_preview', function() {
*/
onPrintScalingDisabledForSourcePDF_: function() {
cr.dispatchSimpleEvent(this, NativeLayer.EventType.DISABLE_SCALING);
+ },
+
+ /**
+ * Cancel the preview and close the preview dialog. This function is called
+ * from C++ testing code.
+ * @private
+ */
+ autoCancelPrintPreviewForTesting_: function() {
+ cr.dispatchSimpleEvent(
+ this, NativeLayer.EventType.AUTO_CANCEL_FOR_TESTING);
}
};

Powered by Google App Engine
This is Rietveld 408576698