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

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: Addressed Lei'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 7d4a2adcba895a363e532094d78bbfea878ca6de..72e883041ee602386bb00d7a2368f3193d4af1fa 100644
--- a/chrome/test/data/webui/print_preview.js
+++ b/chrome/test/data/webui/print_preview.js
@@ -398,3 +398,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