Commit 7f74a4ee authored by tim@chromium.org's avatar tim@chromium.org

Fix issue 11006 - any plugin process started by InProcessBrowserTest was

using the unit_test executable rather than chrome.exe.  This patch repurposes
the --renderer-path switch to be --browser-subprocess-path for both plugins and
renderers.  

BUG=11006
TEST=Any InProcessBrowserTest (they all will start at least one renderer). Use
NavigateToURL to a URL containing flash, we shouldn't crash.


Review URL: http://codereview.chromium.org/99011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14951 0039d316-1c4b-4281-b951-d872f2087c98
parent 06f66670
......@@ -318,16 +318,16 @@ bool PluginProcessHost::Init(const WebPluginInfo& info,
// build command line for plugin, we have to quote the plugin's path to deal
// with spaces.
std::wstring exe_path;
if (!PathService::Get(base::FILE_EXE, &exe_path))
const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
std::wstring exe_path =
browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath);
if (exe_path.empty() && !PathService::Get(base::FILE_EXE, &exe_path))
return false;
CommandLine cmd_line(exe_path);
if (logging::DialogsAreSuppressed())
cmd_line.AppendSwitch(switches::kNoErrorDialogs);
const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
// propagate the following switches to the plugin command line (along with
// any associated values) if present in the browser command line
static const wchar_t* const switch_names[] = {
......
......@@ -220,7 +220,7 @@ bool BrowserRenderProcessHost::Init() {
// Build command line for renderer, we have to quote the executable name to
// deal with spaces.
std::wstring renderer_path =
browser_command_line.GetSwitchValue(switches::kRendererPath);
browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath);
if (renderer_path.empty()) {
if (!GetRendererPath(&renderer_path)) {
// Need to reset the channel we created above or others might think the
......
......@@ -66,8 +66,8 @@ const wchar_t kHomePage[] = L"homepage";
// Causes the process to run as renderer instead of as browser.
const wchar_t kRendererProcess[] = L"renderer";
// Path to the exe to run for the renderer subprocess
const wchar_t kRendererPath[] = L"renderer-path";
// Path to the exe to run for the renderer and plugin subprocesses.
const wchar_t kBrowserSubprocessPath[] = L"browser-subprocess-path";
// Causes the process to run as a plugin subprocess.
const wchar_t kPluginProcess[] = L"plugin";
......
......@@ -27,7 +27,7 @@ extern const wchar_t kProcessChannelID[];
extern const wchar_t kTestingChannelID[];
extern const wchar_t kHomePage[];
extern const wchar_t kRendererProcess[];
extern const wchar_t kRendererPath[];
extern const wchar_t kBrowserSubprocessPath[];
extern const wchar_t kPluginProcess[];
extern const wchar_t kWorkerProcess[];
extern const wchar_t kSingleProcess[];
......
......@@ -100,15 +100,16 @@ void InProcessBrowserTest::SetUp() {
if (command_line->HasSwitch(switches::kSingleProcess))
RenderProcessHost::set_run_renderer_in_process(true);
// Explicitly set the path of the exe used for the renderer, otherwise it'll
// try to use unit_test.exe.
std::wstring renderer_path;
PathService::Get(base::FILE_EXE, &renderer_path);
FilePath fp_renderer_path = FilePath::FromWStringHack(renderer_path);
renderer_path = fp_renderer_path.DirName().ToWStringHack();
file_util::AppendToPath(&renderer_path,
// Explicitly set the path of the exe used for the renderer and plugin,
// otherwise they'll try to use unit_test.exe.
std::wstring subprocess_path;
PathService::Get(base::FILE_EXE, &subprocess_path);
FilePath fp_subprocess_path = FilePath::FromWStringHack(subprocess_path);
subprocess_path = fp_subprocess_path.DirName().ToWStringHack();
file_util::AppendToPath(&subprocess_path,
chrome::kBrowserProcessExecutablePath);
command_line->AppendSwitchWithValue(switches::kRendererPath, renderer_path);
command_line->AppendSwitchWithValue(switches::kBrowserSubprocessPath,
subprocess_path);
sandbox::SandboxInterfaceInfo sandbox_info = {0};
SandboxInitWrapper sandbox_wrapper;
......
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