summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2014-10-23 15:02:38 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-23 22:03:00 +0000
commit52a87b3b54cffd55558d614ef45c78f796c18253 (patch)
tree65f3eb8ff3721ebe6addedc86382ef9bb846117a /chrome
parent26f63992473dda66e4ed2b22f35d4ccd0702ddcd (diff)
downloadchromium_src-52a87b3b54cffd55558d614ef45c78f796c18253.zip
chromium_src-52a87b3b54cffd55558d614ef45c78f796c18253.tar.gz
chromium_src-52a87b3b54cffd55558d614ef45c78f796c18253.tar.bz2
Android: Do not build any extensions code except for extensions_constants.
BUG=424746 Review URL: https://codereview.chromium.org/673663004 Cr-Commit-Position: refs/heads/master@{#300958}
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/BUILD.gn7
-rw-r--r--chrome/chrome_common.gypi35
-rw-r--r--chrome/chrome_renderer.gypi2
-rw-r--r--chrome/chrome_repack_resources.gypi4
-rw-r--r--chrome/chrome_tests_unit.gypi9
-rw-r--r--chrome/common/BUILD.gn18
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc36
-rw-r--r--chrome/renderer/chrome_content_renderer_client.h2
-rw-r--r--chrome/renderer/chrome_content_renderer_client_unittest.cc36
-rw-r--r--chrome/test/BUILD.gn14
-rw-r--r--chrome/test/base/chrome_unit_test_suite.cc11
11 files changed, 122 insertions, 52 deletions
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 40dd295..4b6df7b 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -267,6 +267,7 @@ static_library("browser") {
if (!use_aura || is_win || is_chromeos) {
sources -= [ "background/background_mode_manager_aura.cc" ]
}
+ defines += [ "ENABLE_BACKGROUND=1" ]
}
if (enable_task_manager) {
sources += rebase_path(gypi_values.chrome_browser_task_manager_sources,
@@ -743,8 +744,6 @@ source_set("test_support") {
"download/download_test_file_activity_observer.h",
"download/test_download_shelf.cc",
"download/test_download_shelf.h",
- "extensions/extension_action_test_util.cc",
- "extensions/extension_action_test_util.h",
"invalidation/fake_invalidation_service.cc",
"invalidation/fake_invalidation_service.h",
"media/fake_desktop_media_list.cc",
@@ -819,6 +818,10 @@ source_set("test_support") {
}
if (enable_extensions) {
+ sources += [
+ "extensions/extension_action_test_util.cc",
+ "extensions/extension_action_test_util.h",
+ ]
deps += [
"//extensions:test_support",
]
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 7844282..3e0c727 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -51,20 +51,6 @@
'common/custom_handlers/protocol_handler.cc',
'common/custom_handlers/protocol_handler.h',
'common/descriptors_android.h',
- 'common/extensions/chrome_extension_messages.h',
- 'common/extensions/chrome_extensions_client.cc',
- 'common/extensions/chrome_extensions_client.h',
- 'common/extensions/chrome_utility_extensions_messages.h',
- 'common/extensions/extension_constants.cc',
- 'common/extensions/extension_constants.h',
- 'common/extensions/features/chrome_channel_feature_filter.cc',
- 'common/extensions/features/chrome_channel_feature_filter.h',
- 'common/extensions/features/feature_channel.cc',
- 'common/extensions/features/feature_channel.h',
- 'common/extensions/permissions/chrome_api_permissions.cc',
- 'common/extensions/permissions/chrome_api_permissions.h',
- 'common/extensions/permissions/chrome_permission_message_provider.cc',
- 'common/extensions/permissions/chrome_permission_message_provider.h',
'common/favicon/favicon_url_parser.cc',
'common/favicon/favicon_url_parser.h',
'common/icon_with_badge_image_source.cc',
@@ -172,16 +158,26 @@
'common/extensions/api/url_handlers/url_handlers_parser.h',
'common/extensions/api/webstore/webstore_api_constants.cc',
'common/extensions/api/webstore/webstore_api_constants.h',
+ 'common/extensions/chrome_extension_messages.h',
+ 'common/extensions/chrome_extensions_client.cc',
+ 'common/extensions/chrome_extensions_client.h',
'common/extensions/chrome_manifest_handlers.cc',
'common/extensions/chrome_manifest_handlers.h',
'common/extensions/chrome_manifest_url_handlers.cc',
'common/extensions/chrome_manifest_url_handlers.h',
+ 'common/extensions/chrome_utility_extensions_messages.h',
'common/extensions/command.cc',
'common/extensions/command.h',
+ 'common/extensions/extension_constants.cc',
+ 'common/extensions/extension_constants.h',
'common/extensions/extension_file_util.cc',
'common/extensions/extension_file_util.h',
'common/extensions/extension_process_policy.cc',
'common/extensions/extension_process_policy.h',
+ 'common/extensions/features/chrome_channel_feature_filter.cc',
+ 'common/extensions/features/chrome_channel_feature_filter.h',
+ 'common/extensions/features/feature_channel.cc',
+ 'common/extensions/features/feature_channel.h',
'common/extensions/image_writer/image_writer_util_mac.cc',
'common/extensions/image_writer/image_writer_util_mac.h',
'common/extensions/manifest_handlers/app_isolation_info.cc',
@@ -204,6 +200,10 @@
'common/extensions/manifest_handlers/theme_handler.h',
'common/extensions/manifest_handlers/ui_overrides_handler.cc',
'common/extensions/manifest_handlers/ui_overrides_handler.h',
+ 'common/extensions/permissions/chrome_api_permissions.cc',
+ 'common/extensions/permissions/chrome_api_permissions.h',
+ 'common/extensions/permissions/chrome_permission_message_provider.cc',
+ 'common/extensions/permissions/chrome_permission_message_provider.h',
'common/extensions/sync_helper.cc',
'common/extensions/sync_helper.h',
],
@@ -311,8 +311,7 @@
'<(DEPTH)/components/components.gyp:variations',
'<(DEPTH)/content/content.gyp:content_common',
'<(DEPTH)/crypto/crypto.gyp:crypto',
- '<(DEPTH)/extensions/extensions_resources.gyp:extensions_resources',
- '<(DEPTH)/extensions/extensions_strings.gyp:extensions_strings',
+ '<(DEPTH)/extensions/extensions.gyp:extensions_common_constants',
'<(DEPTH)/media/cast/cast.gyp:cast_net',
'<(DEPTH)/net/net.gyp:net',
'<(DEPTH)/skia/skia.gyp:skia',
@@ -335,6 +334,9 @@
'<(DEPTH)/device/usb/usb.gyp:device_usb',
'<(DEPTH)/chrome/common/extensions/api/api.gyp:chrome_api',
'<(DEPTH)/extensions/common/api/api.gyp:extensions_api',
+ '<(DEPTH)/extensions/extensions.gyp:extensions_common',
+ '<(DEPTH)/extensions/extensions_resources.gyp:extensions_resources',
+ '<(DEPTH)/extensions/extensions_strings.gyp:extensions_strings',
],
'export_dependent_settings': [
'<(DEPTH)/chrome/common/extensions/api/api.gyp:chrome_api',
@@ -361,7 +363,6 @@
'<(DEPTH)/components/components.gyp:signin_core_common',
'<(DEPTH)/components/components.gyp:translate_content_common',
'<(DEPTH)/components/components.gyp:visitedlink_common',
- '<(DEPTH)/extensions/extensions.gyp:extensions_common',
'<(DEPTH)/ipc/ipc.gyp:ipc',
'<(DEPTH)/third_party/re2/re2.gyp:re2',
'<(DEPTH)/third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h',
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi
index dc89fcc..19aa32d 100644
--- a/chrome/chrome_renderer.gypi
+++ b/chrome/chrome_renderer.gypi
@@ -272,7 +272,6 @@
'../content/app/resources/content_resources.gyp:content_resources',
'../content/app/strings/content_strings.gyp:content_strings',
'../content/content.gyp:content_renderer',
- '../extensions/extensions_resources.gyp:extensions_resources',
'../media/cast/cast.gyp:cast_logging_proto',
'../media/cast/cast.gyp:cast_net',
'../media/cast/cast.gyp:cast_sender',
@@ -337,6 +336,7 @@
['enable_extensions==1', {
'dependencies': [
'../extensions/extensions.gyp:extensions_renderer',
+ '../extensions/extensions_resources.gyp:extensions_resources',
# TODO(hclam): See crbug.com/298380 for details.
# We should isolate the APIs needed by the renderer.
'<(DEPTH)/chrome/common/extensions/api/api.gyp:chrome_api',
diff --git a/chrome/chrome_repack_resources.gypi b/chrome/chrome_repack_resources.gypi
index a3ebfab..e7ba8c2 100644
--- a/chrome/chrome_repack_resources.gypi
+++ b/chrome/chrome_repack_resources.gypi
@@ -31,8 +31,6 @@
'<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/content/browser/tracing/tracing_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak',
- '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_renderer_resources.pak',
- '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_resources.pak',
],
}],
['OS != "ios" and OS != "android"', {
@@ -47,6 +45,8 @@
}],
['enable_extensions==1', {
'pak_inputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_renderer_resources.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/extensions/extensions_resources.pak',
'<(grit_out_dir)/extensions_api_resources.pak',
],
}],
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 117c209..598b619 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -1532,8 +1532,6 @@
'browser/download/download_test_file_activity_observer.h',
'browser/download/test_download_shelf.cc',
'browser/download/test_download_shelf.h',
- 'browser/extensions/extension_action_test_util.cc',
- 'browser/extensions/extension_action_test_util.h',
'browser/invalidation/fake_invalidation_service.cc',
'browser/invalidation/fake_invalidation_service.h',
'browser/media/fake_desktop_media_list.cc',
@@ -1597,8 +1595,6 @@
'browser/ui/views/find_bar_host_unittest_util_views.cc',
'browser/ui/website_settings/mock_permission_bubble_request.cc',
'browser/ui/website_settings/mock_permission_bubble_request.h',
- 'common/extensions/extension_test_util.cc',
- 'common/extensions/extension_test_util.h',
'renderer/chrome_mock_render_thread.cc',
'renderer/chrome_mock_render_thread.h',
'renderer/safe_browsing/mock_feature_extractor_clock.cc',
@@ -1800,6 +1796,8 @@
'browser/drive/test_util.h',
'browser/extensions/api/messaging/native_messaging_test_util.cc',
'browser/extensions/api/messaging/native_messaging_test_util.h',
+ 'browser/extensions/extension_action_test_util.cc',
+ 'browser/extensions/extension_action_test_util.h',
'browser/extensions/extension_notification_observer.cc',
'browser/extensions/extension_notification_observer.h',
'browser/extensions/mock_extension_special_storage_policy.cc',
@@ -1818,6 +1816,8 @@
'browser/extensions/test_extension_system.h',
'browser/media_galleries/media_galleries_test_util.cc',
'browser/media_galleries/media_galleries_test_util.h',
+ 'common/extensions/extension_test_util.cc',
+ 'common/extensions/extension_test_util.h',
],
}],
['OS=="win"', {
@@ -2057,6 +2057,7 @@
['exclude', '^browser/extensions/'],
['exclude', '^browser/sync/glue/extensions_activity_monitor_unittest.cc'],
['exclude', '^browser/sync_file_system/'],
+ ['exclude', '^browser/web_applications/'],
['exclude', '^common/extensions/'],
['exclude', '^utility/extensions/'],
['exclude', '^utility/image_writer/'],
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn
index d295f52..046475c 100644
--- a/chrome/common/BUILD.gn
+++ b/chrome/common/BUILD.gn
@@ -24,6 +24,8 @@ grit("resources") {
# GYP version: chrome/chrome_resources.gyp:chrome_resources
# (generate_extensions_api_resources action)
+if (enable_extensions) {
+
grit("extensions_api_resources") {
source = "extensions_api_resources.grd"
output_dir = "$root_gen_dir/chrome"
@@ -33,6 +35,8 @@ grit("extensions_api_resources") {
]
}
+}
+
# GYP version: chrome/chrome_common.gyp:common
static_library("common") {
sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
@@ -62,8 +66,7 @@ static_library("common") {
"//components/variations",
"//content/public/common",
"//crypto",
- "//extensions:extensions_resources",
- "//extensions/strings",
+ "//extensions/common:common_constants",
"//media/cast:net",
"//net",
"//skia",
@@ -106,6 +109,8 @@ static_library("common") {
"//chrome/common/extensions/api",
"//extensions/common",
"//extensions/common/api",
+ "//extensions:extensions_resources",
+ "//extensions/strings",
]
}
@@ -288,8 +293,6 @@ source_set("test_support") {
visibility = [ "//chrome/test:test_support" ]
sources = [
- "extensions/extension_test_util.cc",
- "extensions/extension_test_util.h",
]
deps = [
@@ -307,4 +310,11 @@ source_set("test_support") {
]
}
+ if (enable_extensions) {
+ sources += [
+ "extensions/extension_test_util.cc",
+ "extensions/extension_test_util.h",
+ ]
+ }
+
}
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index d885877..671c197e 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -19,9 +19,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/crash_keys.h"
-#include "chrome/common/extensions/chrome_extensions_client.h"
#include "chrome/common/extensions/extension_constants.h"
-#include "chrome/common/extensions/extension_process_policy.h"
#include "chrome/common/localized_error.h"
#include "chrome/common/pepper_permission_util.h"
#include "chrome/common/render_messages.h"
@@ -79,10 +77,6 @@
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/render_view_visitor.h"
#include "extensions/common/constants.h"
-#include "extensions/common/extension.h"
-#include "extensions/common/extension_set.h"
-#include "extensions/common/extension_urls.h"
-#include "extensions/common/switches.h"
#include "ipc/ipc_sync_channel.h"
#include "net/base/net_errors.h"
#include "ppapi/c/private/ppb_nacl_private.h"
@@ -112,11 +106,17 @@
#endif
#if defined(ENABLE_EXTENSIONS)
+#include "chrome/common/extensions/chrome_extensions_client.h"
+#include "chrome/common/extensions/extension_process_policy.h"
#include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h"
#include "chrome/renderer/extensions/chrome_extensions_renderer_client.h"
#include "chrome/renderer/extensions/extension_frame_helper.h"
#include "chrome/renderer/extensions/renderer_permissions_policy_delegate.h"
#include "chrome/renderer/extensions/resource_request_policy.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/extension_set.h"
+#include "extensions/common/extension_urls.h"
+#include "extensions/common/switches.h"
#include "extensions/renderer/dispatcher.h"
#include "extensions/renderer/extension_helper.h"
#include "extensions/renderer/extensions_render_frame_observer.h"
@@ -268,9 +268,9 @@ void IsGuestViewApiAvailableToScriptContext(
ChromeContentRendererClient::ChromeContentRendererClient() {
g_current_client = this;
+#if defined(ENABLE_EXTENSIONS)
extensions::ExtensionsClient::Set(
extensions::ChromeExtensionsClient::GetInstance());
-#if defined(ENABLE_EXTENSIONS)
extensions::ExtensionsRendererClient::Set(
ChromeExtensionsRendererClient::GetInstance());
#endif
@@ -955,6 +955,7 @@ GURL ChromeContentRendererClient::GetNaClContentHandlerURL(
return GURL();
}
+#if !defined(DISABLE_NACL)
// static
bool ChromeContentRendererClient::IsNaClAllowed(
const GURL& manifest_url,
@@ -996,17 +997,21 @@ bool ChromeContentRendererClient::IsNaClAllowed(
bool is_whitelisted_app = is_photo_app || is_hangouts_app;
- bool is_extension_from_webstore = extension &&
- extension->from_webstore();
+ bool is_extension_from_webstore = false;
+ bool is_invoked_by_hosted_app = false;
+ bool is_extension_unrestricted = false;
+#if defined(ENABLE_EXTENSIONS)
+ is_extension_from_webstore = extension && extension->from_webstore();
- bool is_invoked_by_hosted_app = extension &&
+ is_invoked_by_hosted_app = extension &&
extension->is_hosted_app() &&
extension->web_extent().MatchesURL(app_url);
// Allow built-in extensions and extensions under development.
- bool is_extension_unrestricted = extension &&
+ is_extension_unrestricted = extension &&
(extension->location() == extensions::Manifest::COMPONENT ||
extensions::Manifest::IsUnpackedLocation(extension->location()));
+#endif // defined(ENABLE_EXTENSIONS)
bool is_invoked_by_extension = app_url.SchemeIs("chrome-extension");
@@ -1056,6 +1061,7 @@ bool ChromeContentRendererClient::IsNaClAllowed(
}
return is_nacl_allowed;
}
+#endif // defined(DISABLE_NACL)
bool ChromeContentRendererClient::HasErrorPage(int http_status_code,
std::string* error_domain) {
@@ -1497,7 +1503,11 @@ void ChromeContentRendererClient::AddKeySystems(
bool ChromeContentRendererClient::ShouldReportDetailedMessageForSource(
const base::string16& source) const {
+#if defined(ENABLE_EXTENSIONS)
return extensions::IsSourceFromAnExtension(source);
+#else
+ return false;
+#endif
}
bool ChromeContentRendererClient::ShouldEnableSiteIsolationPolicy() const {
@@ -1506,8 +1516,12 @@ bool ChromeContentRendererClient::ShouldEnableSiteIsolationPolicy() const {
// running a normal web page from the Internet. We only turn on
// SiteIsolationPolicy for a renderer process that does not have the extension
// flag on.
+#if defined(ENABLE_EXTENSIONS)
CommandLine* command_line = CommandLine::ForCurrentProcess();
return !command_line->HasSwitch(extensions::switches::kExtensionProcess);
+#else
+ return true;
+#endif
}
blink::WebWorkerPermissionClientProxy*
diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h
index c5590c0..9c3ac3a 100644
--- a/chrome/renderer/chrome_content_renderer_client.h
+++ b/chrome/renderer/chrome_content_renderer_client.h
@@ -191,6 +191,7 @@ class ChromeContentRendererClient : public content::ContentRendererClient {
static GURL GetNaClContentHandlerURL(const std::string& actual_mime_type,
const content::WebPluginInfo& plugin);
+#if !defined(DISABLE_NACL)
// Determines if a NaCl app is allowed, and modifies params to pass the app's
// permissions to the trusted NaCl plugin.
static bool IsNaClAllowed(const GURL& manifest_url,
@@ -198,6 +199,7 @@ class ChromeContentRendererClient : public content::ContentRendererClient {
bool is_nacl_unrestricted,
const extensions::Extension* extension,
blink::WebPluginParams* params);
+#endif
scoped_ptr<ChromeRenderProcessObserver> chrome_observer_;
scoped_ptr<web_cache::WebCacheRenderProcessObserver> web_cache_observer_;
diff --git a/chrome/renderer/chrome_content_renderer_client_unittest.cc b/chrome/renderer/chrome_content_renderer_client_unittest.cc
index 6e6876c..3c07a12 100644
--- a/chrome/renderer/chrome_content_renderer_client_unittest.cc
+++ b/chrome/renderer/chrome_content_renderer_client_unittest.cc
@@ -9,47 +9,65 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/renderer/searchbox/search_bouncer.h"
#include "content/public/common/webplugininfo.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
+
+#if defined(ENABLE_EXTENSIONS)
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/manifest_constants.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#endif
+
+#if !defined(DISABLE_NACL)
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/web/WebPluginParams.h"
-#include "url/gurl.h"
+#endif
+#if !defined(DISABLE_NACL)
using blink::WebPluginParams;
using blink::WebString;
using blink::WebVector;
+#endif
+
using content::WebPluginInfo;
using content::WebPluginMimeType;
namespace {
+
+#if !defined(DISABLE_NACL)
const bool kNaClRestricted = false;
const bool kNaClUnrestricted = true;
const bool kExtensionRestricted = false;
const bool kExtensionUnrestricted = true;
const bool kExtensionNotFromWebStore = false;
const bool kExtensionFromWebStore = true;
+#endif
+
+#if defined(ENABLE_EXTENSIONS)
const bool kNotHostedApp = false;
const bool kHostedApp = true;
+#endif
+#if !defined(DISABLE_NACL)
const char kExtensionUrl[] = "chrome-extension://extension_id/background.html";
const char kPhotosAppURL1[] = "https://foo.plus.google.com";
const char kPhotosAppURL2[] = "https://foo.plus.sandbox.google.com";
const char kPhotosManifestURL1[] = "https://ssl.gstatic.com/s2/oz/nacl/foo";
const char kPhotosManifestURL2[] = "https://ssl.gstatic.com/photos/nacl/foo";
-
-const char kChatAppURL1[] = "https://foo.talkgadget.google.com/hangouts/foo";
-const char kChatAppURL2[] = "https://foo.plus.google.com/hangouts/foo";
-const char kChatAppURL3[] = "https://foo.plus.sandbox.google.com/hangouts/foo";
const char kChatManifestFS1[] =
"filesystem:https://foo.talkgadget.google.com/foo";
const char kChatManifestFS2[] = "filesystem:https://foo.plus.google.com/foo";
const char kChatManifestFS3[] =
"filesystem:https://foo.plus.sandbox.google.com/foo";
+#endif
+const char kChatAppURL1[] = "https://foo.talkgadget.google.com/hangouts/foo";
+const char kChatAppURL2[] = "https://foo.plus.google.com/hangouts/foo";
+const char kChatAppURL3[] = "https://foo.plus.sandbox.google.com/hangouts/foo";
+
+#if !defined(DISABLE_NACL)
bool AllowsDevInterfaces(const WebPluginParams& params) {
for (size_t i = 0; i < params.attributeNames.size(); ++i) {
if (params.attributeNames[i] == WebString::fromUTF8("@dev"))
@@ -66,6 +84,7 @@ void AddFakeDevAttribute(WebPluginParams* params) {
params->attributeNames.swap(names);
params->attributeValues.swap(values);
}
+#endif
void AddContentTypeHandler(content::WebPluginInfo* info,
const char* mime_type,
@@ -77,11 +96,13 @@ void AddContentTypeHandler(content::WebPluginInfo* info,
base::UTF8ToUTF16(manifest_url));
info->mime_types.push_back(mime_type_info);
}
+
} // namespace
typedef testing::Test ChromeContentRendererClientTest;
+#if defined(ENABLE_EXTENSIONS)
scoped_refptr<const extensions::Extension> CreateTestExtension(
bool is_unrestricted, bool is_from_webstore, bool is_hosted_app,
const std::string& app_url) {
@@ -118,6 +139,7 @@ scoped_refptr<const extensions::Extension> CreateHostedApp(
return CreateTestExtension(is_unrestricted, is_from_webstore, kHostedApp,
app_url);
}
+#endif // defined(ENABLE_EXTENSIONS)
TEST_F(ChromeContentRendererClientTest, NaClRestriction) {
// Unknown content types have no NaCl module.
@@ -135,6 +157,7 @@ TEST_F(ChromeContentRendererClientTest, NaClRestriction) {
ChromeContentRendererClient::GetNaClContentHandlerURL(
"application/x-foo", info));
}
+#if !defined(DISABLE_NACL)
// --enable-nacl allows all NaCl apps, with 'dev' interfaces.
{
WebPluginParams params;
@@ -372,6 +395,7 @@ TEST_F(ChromeContentRendererClientTest, NaClRestriction) {
"http://example.com/").get(),
&params));
}
+#endif // !defined(DISABLE_NACL)
}
TEST_F(ChromeContentRendererClientTest, AllowPepperMediaStreamAPI) {
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index ef17904..e49cccd 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -7,6 +7,7 @@ import("//build/config/ui.gni")
# GYP version: chrome/chrome_tests_unit.gypi:test_support_common
source_set("test_support") {
+ defines = []
testonly = true
sources = [
@@ -109,7 +110,6 @@ source_set("test_support") {
if (!is_ios) {
deps += [
- "//chrome/common/extensions/api",
"//chrome/plugin",
"//chrome/renderer",
"//chrome/utility",
@@ -122,7 +122,6 @@ source_set("test_support") {
"//components/captive_portal:test_support",
"//components/infobars/core",
"//components/sessions:test_support",
- "//extensions:test_support",
"//google_apis:test_support",
"//ipc:test_support",
"//media:test_support",
@@ -164,6 +163,17 @@ source_set("test_support") {
if (toolkit_views) {
deps += [ "//ui/views:test_support" ]
}
+
+ if (enable_background) {
+ defines += [ "ENABLE_BACKGROUND=1" ]
+ }
+
+ if (enable_extensions) {
+ deps += [
+ "//chrome/common/extensions/api",
+ "//extensions:test_support",
+ ]
+ }
}
source_set("test_support_unit") {
diff --git a/chrome/test/base/chrome_unit_test_suite.cc b/chrome/test/base/chrome_unit_test_suite.cc
index 2ea8d38..d291147 100644
--- a/chrome/test/base/chrome_unit_test_suite.cc
+++ b/chrome/test/base/chrome_unit_test_suite.cc
@@ -27,8 +27,6 @@
#if !defined(OS_IOS)
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
-#include "chrome/common/extensions/chrome_extensions_client.h"
-#include "extensions/common/extension_paths.h"
#include "ui/gl/gl_surface.h"
#endif
@@ -36,6 +34,11 @@
#include "base/memory/shared_memory.h"
#endif
+#if defined(ENABLE_EXTENSIONS)
+#include "chrome/common/extensions/chrome_extensions_client.h"
+#include "extensions/common/extension_paths.h"
+#endif
+
namespace {
// Creates a TestingBrowserProcess for each test.
@@ -127,12 +130,14 @@ void ChromeUnitTestSuite::InitializeProviders() {
chromeos::RegisterPathProvider();
#endif
-#if !defined(OS_IOS)
+#if defined(ENABLE_EXTENSIONS)
extensions::RegisterPathProvider();
extensions::ExtensionsClient::Set(
extensions::ChromeExtensionsClient::GetInstance());
+#endif
+#if !defined(OS_IOS)
content::WebUIControllerFactory::RegisterFactory(
ChromeWebUIControllerFactory::GetInstance());