Commit 28bc65ff authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

Remove the bundled App Shell.app target from //extensions/shell:app_shell.

Per //extensions/shell/README, app_shell is only officially supported on
ChromeOS, and support for Chrome Apps on Mac won't be developed further.
This removes the bundled version of the app_shell and turns it into a
standalone executable. This reduces the platform-specific maintenance burden
for the extensions_browsertests.

This moves the SetAmIBundleOverride() call from the BrowserTestBase subclass
to ContentBrowserTest. While content_browsertests uses the bundled
Content Shell.app, other browsertests do not use bundled binaries and
so this does not belong in the base class.

Bug: 844401, 689306
Test: All extensions_browsertests continue to run.
Change-Id: I300de23bd9cb1a845bd06799887ad386e774b6c7
Reviewed-on: https://chromium-review.googlesource.com/1134217
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575312}
parent 102c5ce5
......@@ -67,6 +67,7 @@
#include "ui/display/display_switches.h"
#if defined(OS_MACOSX)
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "chrome/test/base/scoped_bundle_swizzler_mac.h"
#endif
......@@ -123,6 +124,8 @@ InProcessBrowserTest::InProcessBrowserTest()
#endif // OS_MACOSX
{
#if defined(OS_MACOSX)
base::mac::SetOverrideAmIBundled(true);
// TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this.
// Before we run the browser, we have to hack the path to the exe to match
// what it would be if Chrome was running, because it is used to fork renderer
......
......@@ -56,10 +56,6 @@
#include "base/process/process_handle.h"
#endif
#if defined(OS_MACOSX)
#include "base/mac/foundation_util.h"
#endif
#if defined(USE_AURA)
#include "content/browser/compositor/image_transport_factory.h"
#include "ui/aura/test/event_generator_delegate_aura.h" // nogncheck
......@@ -132,10 +128,6 @@ BrowserTestBase::BrowserTestBase()
use_software_compositing_(false),
set_up_called_(false),
disable_io_checks_(false) {
#if defined(OS_MACOSX)
base::mac::SetOverrideAmIBundled(true);
#endif
ui::test::EnableTestConfigForPlatformWindows();
#if defined(OS_POSIX)
......
......@@ -25,6 +25,10 @@
#include "content/shell/app/shell_main_delegate.h"
#endif
#if defined(OS_MACOSX)
#include "base/mac/foundation_util.h"
#endif
#if !defined(OS_CHROMEOS) && defined(OS_LINUX)
#include "ui/base/ime/input_method_initializer.h"
#endif
......@@ -37,6 +41,8 @@ namespace content {
ContentBrowserTest::ContentBrowserTest() {
#if defined(OS_MACOSX)
base::mac::SetOverrideAmIBundled(true);
// See comment in InProcessBrowserTest::InProcessBrowserTest().
base::FilePath content_shell_path;
CHECK(base::PathService::Get(base::FILE_EXE, &content_shell_path));
......
......@@ -474,10 +474,6 @@ source_set("browser_tests") {
"//ui/display:test_support",
]
if (is_mac) {
# Needed for App Shell.app's Helper.
deps += [ "//extensions/shell:app_shell" ]
}
if (is_chromeos) {
sources += [
"api/cec_private/cec_private_apitest.cc",
......
......@@ -13,10 +13,6 @@ import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
if (is_linux) {
import("//build/linux/extract_symbols.gni")
} else if (is_mac) {
import("//build/config/mac/rules.gni")
import("//third_party/icu/config.gni")
import("//v8/gni/v8.gni")
}
assert(enable_extensions)
......@@ -89,8 +85,6 @@ source_set("app_shell_lib") {
}
sources = [
"app/paths_mac.h",
"app/paths_mac.mm",
"app/shell_main_delegate.cc",
"app/shell_main_delegate.h",
"browser/api/feedback_private/shell_feedback_private_delegate.cc",
......@@ -260,44 +254,24 @@ source_set("app_shell_lib") {
}
}
if (is_mac) {
mac_app_bundle("app_shell") {
testonly = true
output_name = "App Shell"
sources = [
"app/shell_main.cc",
]
deps = [
":app_shell_framework_bundle_data",
"//content/public/app:both",
"//extensions:shell_and_test_pak",
]
ldflags = [
"-rpath",
"@executable_path/../",
]
info_plist = "app/app-Info.plist"
}
} else {
executable("app_shell") {
# testonly because :app_shell_lib is testonly. See :app_shell_lib comment.
testonly = true
sources = [
"app/shell_main.cc",
]
executable("app_shell") {
# testonly because :app_shell_lib is testonly. See :app_shell_lib comment.
testonly = true
sources = [
"app/shell_main.cc",
]
deps = [
":app_shell_lib",
"//build/win:default_exe_manifest",
"//content/public/app:both",
"//extensions:shell_and_test_pak",
]
deps = [
":app_shell_lib",
"//build/win:default_exe_manifest",
"//content/public/app:both",
"//extensions:shell_and_test_pak",
]
if (is_win) {
configs += [ "//build/config/win:windowed" ]
configs -= [ "//build/config/win:console" ]
deps += [ "//sandbox/win:sandbox" ]
}
if (is_win) {
configs += [ "//build/config/win:windowed" ]
configs -= [ "//build/config/win:console" ]
deps += [ "//sandbox/win:sandbox" ]
}
}
......@@ -392,103 +366,6 @@ process_version("version_header") {
output = "$target_gen_dir/common/version.h"
}
if (is_mac) {
bundle_data("app_shell_framework_resources") {
sources = [
"$root_gen_dir/extensions/shell/app_shell_resources.pak",
"$root_out_dir/extensions_shell_and_test.pak",
]
public_deps = [
":resources_grit",
"//extensions:shell_and_test_pak",
]
if (icu_use_data_file) {
sources += [ "$root_out_dir/icudtl.dat" ]
public_deps += [ "//third_party/icu:icudata" ]
}
if (v8_use_external_startup_data) {
sources += [ "$root_out_dir/natives_blob.bin" ]
public_deps += [ "//v8" ]
if (use_v8_context_snapshot) {
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
public_deps += [ "//tools/v8_context_snapshot" ]
} else {
sources += [ "$root_out_dir/snapshot_blob.bin" ]
}
}
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
}
mac_framework_bundle("app_shell_framework") {
testonly = true
output_name = "App Shell Framework"
framework_version = "A"
framework_contents = [ "Resources" ]
sources = [
"app/shell_main_mac.cc",
"app/shell_main_mac.h",
]
public_deps = [
":app_shell_lib",
]
deps = [
":app_shell_framework_resources",
"//content/public/app:both",
]
ldflags = [
"-Wl,-install_name,@rpath/Frameworks/$output_name.framework/$output_name",
]
if (is_component_build) {
ldflags += [
"-rpath",
"@loader_path/../../../../../..",
]
}
info_plist = "app/framework-Info.plist"
}
mac_app_bundle("app_shell_helper_app") {
testonly = true
output_name = "App Shell Helper"
sources = [
"app/shell_main.cc",
]
deps = [
":app_shell_framework+link",
]
# deps must not include //content/public/app:both. shell_main.cc does
# include a #if !defined(OS_MACOSX) block. Rather than use nogncheck there,
# disable checking here so that checking still happens on non-mac targets.
check_includes = false
# The helper is in App Shell.app/Contents/Frameworks/App Shell Helper.app/Contents/MacOS/
# so set rpath up to Contents/ so that the loader can find Frameworks/.
ldflags = [
"-rpath",
"@executable_path/../../../..",
]
info_plist = "app/helper-Info.plist"
}
bundle_data("app_shell_framework_bundle_data") {
testonly = true
sources = [
"$root_out_dir/App Shell Framework.framework",
"$root_out_dir/App Shell Helper.app",
]
outputs = [
"{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
]
public_deps = [
":app_shell_framework+link",
":app_shell_helper_app",
]
}
}
source_set("browser_tests") {
testonly = true
sources = [
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>app.icns</string>
<key>CFBundleIdentifier</key>
<string>org.chromium.AppShell</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSMinimumSystemVersion</key>
<string>${CHROMIUM_MIN_SYSTEM_VERSION}</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.chromium.AppShell.framework</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>????</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.chromium.AppShell.helper</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>${CHROMIUM_MIN_SYSTEM_VERSION}</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>
// Copyright 2014 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.
#ifndef EXTENSIONS_SHELL_APP_PATHS_MAC_H_
#define EXTENSIONS_SHELL_APP_PATHS_MAC_H_
namespace extensions {
// Override the framework bundle path.
void OverrideFrameworkBundlePath();
// Override the helper (child process) path.
void OverrideChildProcessFilePath();
} // namespace extensions
#endif // EXTENSIONS_SHELL_APP_PATHS_MAC_H_
// Copyright 2014 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.
#include "extensions/shell/app/paths_mac.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/path_service.h"
#include "content/public/common/content_paths.h"
namespace extensions {
namespace {
base::FilePath GetFrameworksPath() {
base::FilePath path;
base::PathService::Get(base::FILE_EXE, &path);
// We now have a path .../App Shell.app/Contents/MacOS/App Shell, and want to
// transform it into
// .../App Shell.app/Contents/Frameworks/App Shell Framework.framework.
// But if it's App Shell Helper.app (inside Frameworks), we must go deeper.
if (base::mac::IsBackgroundOnlyProcess()) {
path = path.DirName().DirName().DirName().DirName().DirName();
} else {
path = path.DirName().DirName();
}
DCHECK_EQ("Contents", path.BaseName().value());
path = path.Append("Frameworks");
return path;
}
} // namespace
void OverrideFrameworkBundlePath() {
base::FilePath path =
GetFrameworksPath().Append("App Shell Framework.framework");
base::mac::SetOverrideFrameworkBundlePath(path);
}
void OverrideChildProcessFilePath() {
base::FilePath path = GetFrameworksPath()
.Append("App Shell Helper.app")
.Append("Contents")
.Append("MacOS")
.Append("App Shell Helper");
base::PathService::Override(content::CHILD_PROCESS_EXE, path);
}
} // namespace extensions
......@@ -3,26 +3,15 @@
// found in the LICENSE file.
#include "build/build_config.h"
#include "content/public/app/content_main.h"
#include "extensions/shell/app/shell_main_delegate.h"
#if defined(OS_WIN)
#include "content/public/app/sandbox_helper_win.h"
#include "sandbox/win/src/sandbox_types.h"
#endif
#if defined(OS_MACOSX)
#include "extensions/shell/app/shell_main_mac.h"
#else
#include "content/public/app/content_main.h"
#include "extensions/shell/app/shell_main_delegate.h"
#endif
#if defined(OS_MACOSX)
int main(int argc, const char** argv) {
// Do the delegate work in shell_main_mac to avoid having to export the
// delegate types.
return ::ContentMain(argc, argv);
}
#elif defined(OS_WIN)
#if defined(OS_WIN)
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
extensions::ShellMainDelegate delegate;
content::ContentMainParams params(&delegate);
......@@ -34,7 +23,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
return content::ContentMain(params);
}
#else // non-Mac POSIX
#else
int main(int argc, const char** argv) {
extensions::ShellMainDelegate delegate;
content::ContentMainParams params(&delegate);
......
......@@ -27,11 +27,6 @@
#include "chromeos/chromeos_paths.h"
#endif
#if defined(OS_MACOSX)
#include "base/mac/foundation_util.h"
#include "extensions/shell/app/paths_mac.h"
#endif
#if BUILDFLAG(ENABLE_NACL)
#include "components/nacl/common/nacl_switches.h" // nogncheck
#if defined(OS_LINUX)
......@@ -120,17 +115,12 @@ void InitLogging() {
// Returns the path to the extensions_shell_and_test.pak file.
base::FilePath GetResourcesPakFilePath() {
#if defined(OS_MACOSX)
return base::mac::PathForFrameworkBundleResource(
CFSTR("extensions_shell_and_test.pak"));
#else
base::FilePath extensions_shell_and_test_pak_path;
base::PathService::Get(base::DIR_MODULE, &extensions_shell_and_test_pak_path);
extensions_shell_and_test_pak_path =
extensions_shell_and_test_pak_path.AppendASCII(
"extensions_shell_and_test.pak");
return extensions_shell_and_test_pak_path;
#endif // OS_MACOSX
}
} // namespace
......@@ -148,12 +138,6 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
content_client_.reset(CreateContentClient());
SetContentClient(content_client_.get());
#if defined(OS_MACOSX)
OverrideChildProcessFilePath();
// This must happen before InitializeResourceBundle.
OverrideFrameworkBundlePath();
#endif
#if defined(OS_CHROMEOS)
chromeos::RegisterPathProvider();
#endif
......
// Copyright 2014 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.
#include "extensions/shell/app/shell_main_mac.h"
#include "content/public/app/content_main.h"
#include "extensions/shell/app/shell_main_delegate.h"
int ContentMain(int argc, const char** argv) {
extensions::ShellMainDelegate delegate;
content::ContentMainParams params(&delegate);
params.argc = argc;
params.argv = argv;
return content::ContentMain(params);
}
// Copyright 2014 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.
#ifndef EXTENSIONS_SHELL_APP_SHELL_MAIN_MAC_H_
#define EXTENSIONS_SHELL_APP_SHELL_MAIN_MAC_H_
#include "build/build_config.h"
extern "C" {
__attribute__((visibility("default"))) int ContentMain(int argc,
const char** argv);
} // extern "C"
#endif // EXTENSIONS_SHELL_APP_SHELL_MAIN_MAC_H_
......@@ -4,14 +4,10 @@
#include "extensions/shell/test/shell_test.h"
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "build/build_config.h"
#include "content/public/common/content_switches.h"
#include "extensions/browser/extension_system.h"
#include "extensions/shell/browser/desktop_controller.h"
......@@ -23,18 +19,6 @@ namespace extensions {
AppShellTest::AppShellTest()
: browser_context_(nullptr),
extension_system_(nullptr) {
#if defined(OS_MACOSX)
// TODO(phajdan.jr): Make browser tests self-contained on Mac; remove this.
// Set up the application path as though we we are inside the App Shell.app
// bundle, rather than the top-level extensions_browsertests, because we
// make many assumptions about where the executable is located.
base::FilePath app_shell_path;
CHECK(base::PathService::Get(base::FILE_EXE, &app_shell_path));
app_shell_path = app_shell_path.DirName();
app_shell_path = app_shell_path.Append(
FILE_PATH_LITERAL("App Shell.app/Contents/MacOS/App Shell"));
CHECK(base::PathService::Override(base::FILE_EXE, app_shell_path));
#endif
}
AppShellTest::~AppShellTest() {
......
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