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); |
} |
}; |