summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/chrome_dll_main.cc20
-rw-r--r--chrome/test/in_process_browser_test.cc9
2 files changed, 29 insertions, 0 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 487d781..d65908c 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -648,6 +648,26 @@ int ChromeMain(int argc, char** argv) {
}
}
+#if defined(OS_MACOSX)
+ // Mac Chrome is packaged with a main app bundle and a helper app bundle.
+ // The main app bundle should only be used for the browser process, so it
+ // should never see a --type switch (switches::kProcessType). Likewise,
+ // the helper should always have a --type switch.
+ //
+ // This check is done this late so there is already a call to
+ // mac_util::IsBackgroundOnlyProcess(), so there is no change in
+ // startup/initialization order.
+
+ // The helper's Info.plist marks it as a background only app.
+ if (mac_util::IsBackgroundOnlyProcess()) {
+ CHECK(parsed_command_line.HasSwitch(switches::kProcessType))
+ << "Helper application requires --type.";
+ } else {
+ CHECK(!parsed_command_line.HasSwitch(switches::kProcessType))
+ << "Main application forbids --type, saw \"" << process_type << "\".";
+ }
+#endif // defined(OS_MACOSX)
+
if (IsCrashReporterEnabled())
InitCrashProcessInfo();
#endif // OS_MACOSX
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 61ece39..949130c 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -166,6 +166,15 @@ void InProcessBrowserTest::SetUp() {
subprocess_path = subprocess_path.DirName();
subprocess_path = subprocess_path.AppendASCII(WideToASCII(
chrome::kBrowserProcessExecutablePath));
+#if defined(OS_MACOSX)
+ // Recreate the real environment, run the helper within the app bundle.
+ subprocess_path = subprocess_path.DirName().DirName();
+ DCHECK_EQ(subprocess_path.BaseName().value(), "Contents");
+ subprocess_path =
+ subprocess_path.Append("Versions").Append(chrome::kChromeVersion);
+ subprocess_path =
+ subprocess_path.Append(chrome::kHelperProcessExecutablePath);
+#endif
command_line->AppendSwitchPath(switches::kBrowserSubprocessPath,
subprocess_path);
#endif