Commit 31c6bcaa authored by fgorski@chromium.org's avatar fgorski@chromium.org

Revert 272587 "Remove kEnablePrintPreview now that the pdf plugi..."

Reverting bacuse of failure of ClosingWindowWhilePrintingShouldNotCrash
after it was enabled by this change on Linux Tests.

> Remove kEnablePrintPreview now that the pdf plugin is part of Chromium.
> 
> R=thestig@chromium.org
> 
> Review URL: https://codereview.chromium.org/296453015

TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/299273003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272622 0039d316-1c4b-4281-b951-d872f2087c98
parent bd0cc65f
...@@ -1101,7 +1101,23 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) { ...@@ -1101,7 +1101,23 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) {
->HasFocus()); ->HasFocus());
} }
#if defined(OS_WIN) || defined(OS_LINUX) // The next three tests will only run automatically with Chrome branded builds
// because they require the PDF preview plug-in. To run these tests manually for
// Chromium (non-Chrome branded) builds in a development environment:
//
// 1) Remove "MAYBE_" in the first line of each test definition
// 2) Build Chromium browser_tests
// 3) Make a copy of the PDF plug-in from a recent version of Chrome (Canary
// or a recent development build) to your Chromium build:
// - On Linux and Chrome OS, copy /opt/google/chrome/libpdf.so to
// <path-to-your-src>/out/Debug
// - On OS X, copy PDF.plugin from
// <recent-chrome-app-folder>/*/*/*/*/"Internet Plug-Ins" to
// <path-to-your-src>/out/Debug/Chromium.app/*/*/*/*/"Internet Plug-Ins"
// 4) Run browser_tests with the --enable-print-preview flag
#if !defined(GOOGLE_CHROME_BUILD) || \
(defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX)))
#define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \
DISABLED_WindowDotPrintShouldBringUpPrintPreview DISABLED_WindowDotPrintShouldBringUpPrintPreview
#else #else
...@@ -1116,9 +1132,17 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ...@@ -1116,9 +1132,17 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
preview_delegate.WaitUntilPreviewIsReady(); preview_delegate.WaitUntilPreviewIsReady();
} }
#if !defined(GOOGLE_CHROME_BUILD)
#define MAYBE_ClosingWindowWhilePrintingShouldNotCrash \
DISABLED_ClosingWindowWhilePrintingShouldNotCrash
#else
#define MAYBE_ClosingWindowWhilePrintingShouldNotCrash \
ClosingWindowWhilePrintingShouldNotCrash
#endif
// This test verifies that http://crbug.com/297179 is fixed. // This test verifies that http://crbug.com/297179 is fixed.
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
ClosingWindowWhilePrintingShouldNotCrash) { MAYBE_ClosingWindowWhilePrintingShouldNotCrash) {
ScopedPreviewTestingDelegate preview_delegate(false); ScopedPreviewTestingDelegate preview_delegate(false);
ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_;
preview_delegate.WaitUntilPreviewIsReady(); preview_delegate.WaitUntilPreviewIsReady();
...@@ -1127,7 +1151,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ...@@ -1127,7 +1151,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
// This test currently only passes on OS X (on other platforms the print preview // This test currently only passes on OS X (on other platforms the print preview
// dialog's size is limited by the size of the window being printed). // dialog's size is limited by the size of the window being printed).
#if !defined(OS_MACOSX) #if !defined(GOOGLE_CHROME_BUILD) || !defined(OS_MACOSX)
#define MAYBE_PrintPreviewShouldNotBeTooSmall \ #define MAYBE_PrintPreviewShouldNotBeTooSmall \
DISABLED_PrintPreviewShouldNotBeTooSmall DISABLED_PrintPreviewShouldNotBeTooSmall
#else #else
......
...@@ -57,7 +57,11 @@ const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry ...@@ -57,7 +57,11 @@ const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry
prefs::kAllowCrossOriginAuthPrompt, true }, prefs::kAllowCrossOriginAuthPrompt, true },
{ switches::kDisableSSLFalseStart, prefs::kDisableSSLRecordSplitting, { switches::kDisableSSLFalseStart, prefs::kDisableSSLRecordSplitting,
true }, true },
#if defined(GOOGLE_CHROME_BUILD)
{ switches::kDisablePrintPreview, prefs::kPrintPreviewDisabled, true }, { switches::kDisablePrintPreview, prefs::kPrintPreviewDisabled, true },
#else
{ switches::kEnablePrintPreview, prefs::kPrintPreviewDisabled, false },
#endif
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
{ chromeos::switches::kEnableTouchpadThreeFingerClick, { chromeos::switches::kEnableTouchpadThreeFingerClick,
prefs::kEnableTouchpadThreeFingerClick, true }, prefs::kEnableTouchpadThreeFingerClick, true },
......
...@@ -2,12 +2,14 @@ ...@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chrome/browser/printing/print_preview_dialog_controller.h" #include "chrome/browser/printing/print_preview_dialog_controller.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/print_messages.h" #include "chrome/common/print_messages.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
...@@ -121,6 +123,12 @@ class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest { ...@@ -121,6 +123,12 @@ class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest {
} }
private: private:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
#if !defined(GOOGLE_CHROME_BUILD)
command_line->AppendSwitch(switches::kEnablePrintPreview);
#endif
}
virtual void SetUpOnMainThread() OVERRIDE { virtual void SetUpOnMainThread() OVERRIDE {
WebContents* first_tab = WebContents* first_tab =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
......
...@@ -353,7 +353,11 @@ void ProfileImpl::RegisterProfilePrefs( ...@@ -353,7 +353,11 @@ void ProfileImpl::RegisterProfilePrefs(
#endif #endif
registry->RegisterBooleanPref( registry->RegisterBooleanPref(
prefs::kPrintPreviewDisabled, prefs::kPrintPreviewDisabled,
#if defined(GOOGLE_CHROME_BUILD)
false, false,
#else
true,
#endif
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
registry->RegisterBooleanPref( registry->RegisterBooleanPref(
prefs::kForceEphemeralProfiles, prefs::kForceEphemeralProfiles,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h"
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
...@@ -12,6 +13,7 @@ ...@@ -12,6 +13,7 @@
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
...@@ -44,6 +46,12 @@ class PrintPreviewTest : public InProcessBrowserTest { ...@@ -44,6 +46,12 @@ class PrintPreviewTest : public InProcessBrowserTest {
public: public:
PrintPreviewTest() {} PrintPreviewTest() {}
#if !defined(GOOGLE_CHROME_BUILD)
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
command_line->AppendSwitch(switches::kEnablePrintPreview);
}
#endif
void Print() { void Print() {
content::TestNavigationObserver nav_observer(NULL); content::TestNavigationObserver nav_observer(NULL);
nav_observer.StartWatchingNewWebContents(); nav_observer.StartWatchingNewWebContents();
......
...@@ -331,9 +331,6 @@ const char kDisablePreconnect[] = "disable-preconnect"; ...@@ -331,9 +331,6 @@ const char kDisablePreconnect[] = "disable-preconnect";
const char kDisablePrerenderLocalPredictor[] = const char kDisablePrerenderLocalPredictor[] =
"disable-prerender-local-predictor"; "disable-prerender-local-predictor";
// Disables print preview (For testing, and for users who don't like us. :[ )
const char kDisablePrintPreview[] = "disable-print-preview";
// Normally when the user attempts to navigate to a page that was the result of // Normally when the user attempts to navigate to a page that was the result of
// a post we prompt to make sure they want to. This switch may be used to // a post we prompt to make sure they want to. This switch may be used to
// disable that check. This switch is used during automated testing. // disable that check. This switch is used during automated testing.
...@@ -1412,6 +1409,18 @@ const char kDebugPrint[] = "debug-print"; ...@@ -1412,6 +1409,18 @@ const char kDebugPrint[] = "debug-print";
const char kFileManagerExtensionPath[] = "filemgr-ext-path"; const char kFileManagerExtensionPath[] = "filemgr-ext-path";
#endif #endif
// Controls print preview in the browser process.
#if defined(GOOGLE_CHROME_BUILD)
// Disables print preview (For testing, and for users who don't like us. :[ )
const char kDisablePrintPreview[] = "disable-print-preview";
#else
// Enables print preview. Chromium normally does not have the PDF viewer,
// required for print preview.
// pdf.dll or libpdf.so should be present in primary directory of
// Chromium. For local builds it's usually out/Debug or out/Release.
const char kEnablePrintPreview[] = "enable-print-preview";
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// DO NOT ADD YOUR CRAP TO THE BOTTOM OF THIS FILE. // DO NOT ADD YOUR CRAP TO THE BOTTOM OF THIS FILE.
// //
......
...@@ -100,7 +100,6 @@ extern const char kDisablePnacl[]; ...@@ -100,7 +100,6 @@ extern const char kDisablePnacl[];
extern const char kDisablePopupBlocking[]; extern const char kDisablePopupBlocking[];
extern const char kDisablePreconnect[]; extern const char kDisablePreconnect[];
extern const char kDisablePrerenderLocalPredictor[]; extern const char kDisablePrerenderLocalPredictor[];
extern const char kDisablePrintPreview[];
extern const char kDisablePromptOnRepost[]; extern const char kDisablePromptOnRepost[];
extern const char kDisableQuic[]; extern const char kDisableQuic[];
extern const char kDisableQuicHttps[]; extern const char kDisableQuicHttps[];
...@@ -408,6 +407,12 @@ extern const char kDebugPrint[]; ...@@ -408,6 +407,12 @@ extern const char kDebugPrint[];
extern const char kFileManagerExtensionPath[]; extern const char kFileManagerExtensionPath[];
#endif #endif
#if defined(GOOGLE_CHROME_BUILD)
extern const char kDisablePrintPreview[];
#else
extern const char kEnablePrintPreview[];
#endif
// DON'T ADD RANDOM STUFF HERE. Put it in the main section above in // DON'T ADD RANDOM STUFF HERE. Put it in the main section above in
// alphabetical order, or in one of the ifdefs (also in order in each section). // alphabetical order, or in one of the ifdefs (also in order in each section).
......
...@@ -4,6 +4,17 @@ ...@@ -4,6 +4,17 @@
#include "chrome/test/data/webui/print_preview.h" #include "chrome/test/data/webui/print_preview.h"
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
PrintPreviewWebUITest::PrintPreviewWebUITest() {} PrintPreviewWebUITest::PrintPreviewWebUITest() {}
PrintPreviewWebUITest::~PrintPreviewWebUITest() {} PrintPreviewWebUITest::~PrintPreviewWebUITest() {}
// Always print preview for testing.
void PrintPreviewWebUITest::SetUpCommandLine(CommandLine* command_line) {
WebUIBrowserTest::SetUpCommandLine(command_line);
#if !defined(GOOGLE_CHROME_BUILD)
command_line->AppendSwitch(switches::kEnablePrintPreview);
#endif
}
...@@ -13,6 +13,9 @@ class PrintPreviewWebUITest : public WebUIBrowserTest { ...@@ -13,6 +13,9 @@ class PrintPreviewWebUITest : public WebUIBrowserTest {
virtual ~PrintPreviewWebUITest(); virtual ~PrintPreviewWebUITest();
private: private:
// WebUIBrowserTest implementation.
virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(PrintPreviewWebUITest); DISALLOW_COPY_AND_ASSIGN(PrintPreviewWebUITest);
}; };
......
...@@ -62,7 +62,7 @@ class PathContext(object): ...@@ -62,7 +62,7 @@ class PathContext(object):
"""A PathContext is used to carry the information used to construct URLs and """A PathContext is used to carry the information used to construct URLs and
paths when dealing with the storage server and archives.""" paths when dealing with the storage server and archives."""
def __init__(self, base_url, platform, good_revision, bad_revision, def __init__(self, base_url, platform, good_revision, bad_revision,
is_official, is_aura, flash_path = None): is_official, is_aura, flash_path = None, pdf_path = None):
super(PathContext, self).__init__() super(PathContext, self).__init__()
# Store off the input parameters. # Store off the input parameters.
self.base_url = base_url self.base_url = base_url
...@@ -72,6 +72,7 @@ class PathContext(object): ...@@ -72,6 +72,7 @@ class PathContext(object):
self.is_official = is_official self.is_official = is_official
self.is_aura = is_aura self.is_aura = is_aura
self.flash_path = flash_path self.flash_path = flash_path
self.pdf_path = pdf_path
# The name of the ZIP file in a revision directory on the server. # The name of the ZIP file in a revision directory on the server.
self.archive_name = None self.archive_name = None
...@@ -362,7 +363,7 @@ def RunRevision(context, revision, zipfile, profile, num_runs, command, args): ...@@ -362,7 +363,7 @@ def RunRevision(context, revision, zipfile, profile, num_runs, command, args):
# Run the build as many times as specified. # Run the build as many times as specified.
testargs = ['--user-data-dir=%s' % profile] + args testargs = ['--user-data-dir=%s' % profile] + args
# The sandbox must be run as root on Official Chrome, so bypass it. # The sandbox must be run as root on Official Chrome, so bypass it.
if ((context.is_official or context.flash_path) and if ((context.is_official or context.flash_path or context.pdf_path) and
context.platform.startswith('linux')): context.platform.startswith('linux')):
testargs.append('--no-sandbox') testargs.append('--no-sandbox')
if context.flash_path: if context.flash_path:
...@@ -372,6 +373,10 @@ def RunRevision(context, revision, zipfile, profile, num_runs, command, args): ...@@ -372,6 +373,10 @@ def RunRevision(context, revision, zipfile, profile, num_runs, command, args):
# pass the correct version we just spoof it. # pass the correct version we just spoof it.
testargs.append('--ppapi-flash-version=99.9.999.999') testargs.append('--ppapi-flash-version=99.9.999.999')
if context.pdf_path:
shutil.copy(context.pdf_path, os.path.dirname(context.GetLaunchPath()))
testargs.append('--enable-print-preview')
runcommand = [] runcommand = []
for token in shlex.split(command): for token in shlex.split(command):
if token == "%a": if token == "%a":
...@@ -464,6 +469,7 @@ def Bisect(base_url, ...@@ -464,6 +469,7 @@ def Bisect(base_url,
try_args=(), try_args=(),
profile=None, profile=None,
flash_path=None, flash_path=None,
pdf_path=None,
interactive=True, interactive=True,
evaluate=AskIsGoodBuild): evaluate=AskIsGoodBuild):
"""Given known good and known bad revisions, run a binary search on all """Given known good and known bad revisions, run a binary search on all
...@@ -500,7 +506,7 @@ def Bisect(base_url, ...@@ -500,7 +506,7 @@ def Bisect(base_url,
profile = 'profile' profile = 'profile'
context = PathContext(base_url, platform, good_rev, bad_rev, context = PathContext(base_url, platform, good_rev, bad_rev,
official_builds, is_aura, flash_path) official_builds, is_aura, flash_path, pdf_path)
cwd = os.getcwd() cwd = os.getcwd()
print "Downloading list of known revisions..." print "Downloading list of known revisions..."
...@@ -749,6 +755,12 @@ def main(): ...@@ -749,6 +755,12 @@ def main():
'binary to be used in this bisection (e.g. ' + 'binary to be used in this bisection (e.g. ' +
'on Windows C:\...\pepflashplayer.dll and on Linux ' + 'on Windows C:\...\pepflashplayer.dll and on Linux ' +
'/opt/google/chrome/PepperFlash/libpepflashplayer.so).') '/opt/google/chrome/PepperFlash/libpepflashplayer.so).')
parser.add_option('-d', '--pdf_path', type = 'str',
help = 'Absolute path to a recent PDF pluggin ' +
'binary to be used in this bisection (e.g. ' +
'on Windows C:\...\pdf.dll and on Linux ' +
'/opt/google/chrome/libpdf.so). Option also enables ' +
'print preview.')
parser.add_option('-g', '--good', type = 'str', parser.add_option('-g', '--good', type = 'str',
help = 'A good revision to start bisection. ' + help = 'A good revision to start bisection. ' +
'May be earlier or later than the bad revision. ' + 'May be earlier or later than the bad revision. ' +
...@@ -819,6 +831,11 @@ def main(): ...@@ -819,6 +831,11 @@ def main():
msg = 'Could not find Flash binary at %s' % flash_path msg = 'Could not find Flash binary at %s' % flash_path
assert os.path.exists(flash_path), msg assert os.path.exists(flash_path), msg
if opts.pdf_path:
pdf_path = opts.pdf_path
msg = 'Could not find PDF binary at %s' % pdf_path
assert os.path.exists(pdf_path), msg
if opts.official_builds: if opts.official_builds:
good_rev = LooseVersion(good_rev) good_rev = LooseVersion(good_rev)
bad_rev = LooseVersion(bad_rev) bad_rev = LooseVersion(bad_rev)
...@@ -835,7 +852,7 @@ def main(): ...@@ -835,7 +852,7 @@ def main():
(min_chromium_rev, max_chromium_rev) = Bisect( (min_chromium_rev, max_chromium_rev) = Bisect(
base_url, opts.archive, opts.official_builds, opts.aura, good_rev, base_url, opts.archive, opts.official_builds, opts.aura, good_rev,
bad_rev, opts.times, opts.command, args, opts.profile, opts.flash_path, bad_rev, opts.times, opts.command, args, opts.profile, opts.flash_path,
not opts.not_interactive) opts.pdf_path, not opts.not_interactive)
# Get corresponding blink revisions. # Get corresponding blink revisions.
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment