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

Unified Diff: chrome/test/data/webui/print_preview.js

Issue 7574002: Be able to print items that do window.print(); window.close() (airline tix e.g.) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Kausalya's comments. Created 9 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/test/data/webui/print_preview.js
diff --git a/chrome/test/data/webui/print_preview.js b/chrome/test/data/webui/print_preview.js
index c674612aa18b5f7b96884af4c430fd3a48970948..1ec5557d328f1b2481ff758f8242f5bf5ef23a00 100644
--- a/chrome/test/data/webui/print_preview.js
+++ b/chrome/test/data/webui/print_preview.js
@@ -374,3 +374,46 @@ TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() {
assertNotEquals(null, errorText);
expectFalse(errorText.classList.contains('hidden'));
});
+
+/**
+ * Test fixture to test case when no PDF plugin exists.
+ * @extends {PrintPreviewWebUITest}
+ * @constructor
+ **/
+function PrintPreviewPrintCloseWebUITest() {}
+
+PrintPreviewPrintCloseWebUITest.prototype = {
+ __proto__: PrintPreviewWebUITest.prototype,
+
+ /**
+ * Open a page, which does window.print(); window.close();
+ * @type {?string}
+ * @override
+ **/
+ browsePrintPreload: 'print_preview_print_close_test.html',
+
+ /**
+ * Indicate to browsertest not to print because the page will contain
+ * JavaScript to window.print().
+ * @type {boolean}
+ **/
+ noPrint: true,
+
+ /**
+ * Provide a typedef for C++ to correspond to JS subclass.
+ * @type {?string}
+ * @override
+ **/
+ typedefCppFixture: 'PrintPreviewWebUITest',
+};
+
+// Test that window.print(); window.close() still works with cancel.
+TEST_F('PrintPreviewPrintCloseWebUITest', 'TestPrintCloseCancel', function() {
+ assertTrue(true);
+ this.mockHandler.expects(once()).closePrintPreviewTab().
+ will(callFunction(function() {
+ window.close();
+ }));
+
+ $('cancel-button').click();
+});

Powered by Google App Engine
This is Rietveld 408576698