summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-14 16:21:27 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-14 16:21:27 +0000
commitda8cb193edebc8dc78a422df2633340e6a606cde (patch)
treead529c5ade25a5c05198197f38a35c1fdd245001 /chrome_frame
parent3b250964a2bc37d956755173fe983a3c17f5951a (diff)
downloadchromium_src-da8cb193edebc8dc78a422df2633340e6a606cde.zip
chromium_src-da8cb193edebc8dc78a422df2633340e6a606cde.tar.gz
chromium_src-da8cb193edebc8dc78a422df2633340e6a606cde.tar.bz2
Disable Chrome's print preview in Chrome Frame.
BUG=95568 TEST=do something on a page that calls window.print(); expect IE's print dialog to appear. should be covered by new test in chrome_frame_tests.exe. Review URL: http://codereview.chromium.org/9350044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/chrome_frame_automation.cc5
-rw-r--r--chrome_frame/chrome_launcher.cc3
-rw-r--r--chrome_frame/test/data/window_print.html6
-rw-r--r--chrome_frame/test/ui_test.cc26
4 files changed, 39 insertions, 1 deletions
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index a816e9a..c7f144f 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -270,6 +270,11 @@ void AutomationProxyCacheEntry::CreateProxy(ChromeFrameLaunchParams* params,
command_line->AppendSwitch(switches::kDisablePopupBlocking);
+#if defined(GOOGLE_CHROME_BUILD)
+ // Chrome Frame should use the native print dialog.
+ command_line->AppendSwitch(switches::kDisablePrintPreview);
+#endif
+
// Disable the "Whoa! Chrome has crashed." dialog, because that isn't very
// useful for Chrome Frame users.
#ifndef NDEBUG
diff --git a/chrome_frame/chrome_launcher.cc b/chrome_frame/chrome_launcher.cc
index d89fd8a..e943c7f 100644
--- a/chrome_frame/chrome_launcher.cc
+++ b/chrome_frame/chrome_launcher.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,6 +23,7 @@ const wchar_t* kAllowedSwitches[] = {
L"chrome-version",
L"disable-background-mode",
L"disable-popup-blocking",
+ L"disable-print-preview",
L"disable-renderer-accessibility",
L"enable-experimental-extension-apis",
L"force-renderer-accessibility",
diff --git a/chrome_frame/test/data/window_print.html b/chrome_frame/test/data/window_print.html
new file mode 100644
index 0000000..e93f0e4
--- /dev/null
+++ b/chrome_frame/test/data/window_print.html
@@ -0,0 +1,6 @@
+<html>
+ <head><title>window.print</title></head>
+ <body onload='window.setTimeout("window.print();", 0);'>
+ <p>The native print dialog should appear.</p>
+ </body>
+</html>
diff --git a/chrome_frame/test/ui_test.cc b/chrome_frame/test/ui_test.cc
index 86fc302..8446ab6 100644
--- a/chrome_frame/test/ui_test.cc
+++ b/chrome_frame/test/ui_test.cc
@@ -380,6 +380,32 @@ TEST_P(FullTabUITest, DISABLED_TabCrashRefresh) {
LaunchIEAndNavigate(GetSimplePageUrl());
}
+// Test that window.print() on a page results in the native Windows print dialog
+// appearing rather than Chrome's in-page print preview.
+TEST_P(FullTabUITest, WindowPrintOpensNativePrintDialog) {
+ std::wstring window_print_url(GetTestUrl(L"window_print.html"));
+ std::wstring window_print_title(L"window.print");
+
+ const bool is_cf = GetParam().invokes_cf();
+ MockWindowObserver win_observer_mock;
+
+ // When the page is loaded, start watching for the Print dialog to appear.
+ EXPECT_CALL(ie_mock_, OnLoad(is_cf, StrEq(window_print_url)))
+ .WillOnce(WatchWindow(&win_observer_mock, "Print", ""));
+
+ // When the print dialog opens, close it.
+ EXPECT_CALL(win_observer_mock, OnWindowOpen(_))
+ .WillOnce(DoCloseWindow());
+
+ // When the print dialog closes, close the browser.
+ EXPECT_CALL(win_observer_mock, OnWindowClose(_))
+ .WillOnce(CloseBrowserMock(&ie_mock_));
+
+ // Launch IE and navigate to the window_print.html page, which will
+ // window.print() immediately after loading.
+ LaunchIEAndNavigate(window_print_url);
+}
+
// Test fixture for tests related to the context menu UI. Since the context
// menus for CF and IE are different, these tests are not parameterized.
class ContextMenuTest : public MockIEEventSinkTest, public testing::Test {