summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/all.gyp2
-rw-r--r--build/common.gypi11
-rw-r--r--chrome/browser/browser_process_impl.cc6
-rw-r--r--chrome/browser/browser_process_impl.h2
-rw-r--r--chrome/browser/renderer_host/chrome_render_message_filter.cc6
-rw-r--r--chrome/browser/ui/browser_init.cc75
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.cc2
-rw-r--r--chrome/chrome_browser.gypi5
-rw-r--r--chrome/chrome_tests.gypi7
9 files changed, 79 insertions, 37 deletions
diff --git a/build/all.gyp b/build/all.gyp
index 5984b98..e0fb1ff 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -272,7 +272,7 @@
'conditions': [
# If you change this condition, make sure you also change it
# in chrome_tests.gypi
- ['OS=="mac" or OS=="win" or (os_posix==1 and OS != "android" and target_arch==python_arch)', {
+ ['enable_automation==1 and (OS=="mac" or OS=="win" or (os_posix==1 and target_arch==python_arch))', {
'dependencies': [
'../chrome/chrome.gyp:pyautolib',
],
diff --git a/build/common.gypi b/build/common.gypi
index 702a1fd..6b3dc70 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -429,6 +429,13 @@
}, {
'linux_use_gold_flags%': 0,
}],
+
+ # Enable automation on platforms other than Android.
+ ['OS=="android"', {
+ 'enable_automation%': 0,
+ }, {
+ 'enable_automation%': 1,
+ }],
],
},
@@ -495,6 +502,7 @@
'linux_use_gold_flags%': '<(linux_use_gold_flags)',
'use_canvas_skia_skia%': '<(use_canvas_skia_skia)',
'tests_run%': '<(tests_run)',
+ 'enable_automation%': '<(enable_automation)',
# Whether to build for Wayland display server
'use_wayland%': 0,
@@ -1359,6 +1367,9 @@
['enable_themes==1', {
'defines': ['ENABLE_THEMES=1'],
}],
+ ['enable_automation==1', {
+ 'defines': ['ENABLE_AUTOMATION=1'],
+ }],
], # conditions for 'target_defaults'
'target_conditions': [
['enable_wexit_time_destructors==1', {
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 0fb1a30..b1e0199 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -160,6 +160,7 @@ BrowserProcessImpl::~BrowserProcessImpl() {
}
void BrowserProcessImpl::StartTearDown() {
+#if defined(ENABLE_AUTOMATION)
// Delete the AutomationProviderList before NotificationService,
// since it may try to unregister notifications
// Both NotificationService and AutomationProvider are singleton instances in
@@ -168,6 +169,7 @@ void BrowserProcessImpl::StartTearDown() {
// NotificationService. NotificationService won't be destroyed until after
// this destructor is run.
automation_provider_list_.reset();
+#endif
// We need to shutdown the SdchDictionaryFetcher as it regularly holds
// a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do
@@ -435,9 +437,13 @@ ThumbnailGenerator* BrowserProcessImpl::GetThumbnailGenerator() {
AutomationProviderList* BrowserProcessImpl::GetAutomationProviderList() {
DCHECK(CalledOnValidThread());
+#if defined(ENABLE_AUTOMATION)
if (automation_provider_list_.get() == NULL)
automation_provider_list_.reset(new AutomationProviderList());
return automation_provider_list_.get();
+#else
+ return NULL;
+#endif
}
void BrowserProcessImpl::InitDevToolsHttpProtocolHandler(
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
index f35ae5d..87ba86b 100644
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -187,7 +187,9 @@ class BrowserProcessImpl : public BrowserProcess,
bool created_notification_ui_manager_;
scoped_ptr<NotificationUIManager> notification_ui_manager_;
+#if defined(ENABLE_AUTOMATION)
scoped_ptr<AutomationProviderList> automation_provider_list_;
+#endif
scoped_ptr<GoogleURLTracker> google_url_tracker_;
scoped_ptr<IntranetRedirectDetector> intranet_redirect_detector_;
diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc
index 44d7b590..8dbb3e9 100644
--- a/chrome/browser/renderer_host/chrome_render_message_filter.cc
+++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc
@@ -111,6 +111,7 @@ bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
+#if defined(ENABLE_AUTOMATION)
if ((message.type() == ChromeViewHostMsg_GetCookies::ID ||
message.type() == ChromeViewHostMsg_SetCookie::ID) &&
AutomationResourceMessageFilter::ShouldFilterCookieMessages(
@@ -124,6 +125,7 @@ bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_END_MESSAGE_MAP()
handled = true;
}
+#endif
return handled;
}
@@ -494,15 +496,19 @@ void ChromeRenderMessageFilter::OnGetCookies(
const GURL& url,
const GURL& first_party_for_cookies,
IPC::Message* reply_msg) {
+#if defined(ENABLE_AUTOMATION)
AutomationResourceMessageFilter::GetCookiesForUrl(
this, request_context_->GetURLRequestContext(), render_process_id_,
reply_msg, url);
+#endif
}
void ChromeRenderMessageFilter::OnSetCookie(const IPC::Message& message,
const GURL& url,
const GURL& first_party_for_cookies,
const std::string& cookie) {
+#if defined(ENABLE_AUTOMATION)
AutomationResourceMessageFilter::SetCookiesForUrl(
render_process_id_, message.routing_id(), url, cookie);
+#endif
}
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 7c71eb7..5d5dfae 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -1719,48 +1719,50 @@ bool BrowserInit::ProcessCmdLineImpl(
LOG(ERROR) << "RegisterComponentsForUpdate";
#endif
RegisterComponentsForUpdate(command_line);
+ }
+
+ bool silent_launch = false;
- // Look for the testing channel ID ONLY during process startup
- if (command_line.HasSwitch(switches::kTestingChannelID)) {
- std::string testing_channel_id = command_line.GetSwitchValueASCII(
- switches::kTestingChannelID);
- // TODO(sanjeevr) Check if we need to make this a singleton for
- // compatibility with the old testing code
- // If there are any extra parameters, we expect each one to generate a
- // new tab; if there are none then we get one homepage tab.
- int expected_tab_count = 1;
- if (command_line.HasSwitch(switches::kNoStartupWindow)) {
- expected_tab_count = 0;
+#if defined(ENABLE_AUTOMATION)
+ // Look for the testing channel ID ONLY during process startup
+ if (process_startup &&
+ command_line.HasSwitch(switches::kTestingChannelID)) {
+ std::string testing_channel_id = command_line.GetSwitchValueASCII(
+ switches::kTestingChannelID);
+ // TODO(sanjeevr) Check if we need to make this a singleton for
+ // compatibility with the old testing code
+ // If there are any extra parameters, we expect each one to generate a
+ // new tab; if there are none then we get one homepage tab.
+ int expected_tab_count = 1;
+ if (command_line.HasSwitch(switches::kNoStartupWindow)) {
+ expected_tab_count = 0;
#if defined(OS_CHROMEOS)
- // kLoginManager will cause Chrome to start up with the ChromeOS login
- // screen instead of a browser window, so it won't load any tabs.
- } else if (command_line.HasSwitch(switches::kLoginManager)) {
- expected_tab_count = 0;
+ // kLoginManager will cause Chrome to start up with the ChromeOS login
+ // screen instead of a browser window, so it won't load any tabs.
+ } else if (command_line.HasSwitch(switches::kLoginManager)) {
+ expected_tab_count = 0;
#endif
- } else if (command_line.HasSwitch(switches::kRestoreLastSession)) {
- std::string restore_session_value(
- command_line.GetSwitchValueASCII(switches::kRestoreLastSession));
- base::StringToInt(restore_session_value, &expected_tab_count);
- } else {
- std::vector<GURL> urls_to_open = GetURLsFromCommandLine(
- command_line, cur_dir, last_used_profile);
- expected_tab_count =
- std::max(1, static_cast<int>(urls_to_open.size()));
- }
+ } else if (command_line.HasSwitch(switches::kRestoreLastSession)) {
+ std::string restore_session_value(
+ command_line.GetSwitchValueASCII(switches::kRestoreLastSession));
+ base::StringToInt(restore_session_value, &expected_tab_count);
+ } else {
+ std::vector<GURL> urls_to_open = GetURLsFromCommandLine(
+ command_line, cur_dir, last_used_profile);
+ expected_tab_count =
+ std::max(1, static_cast<int>(urls_to_open.size()));
+ }
#if defined(OS_CHROMEOS)
- // crosbug.com/26446.
- LOG(ERROR) << "CreatingAutomationProvider";
+ // crosbug.com/26446.
+ LOG(ERROR) << "CreatingAutomationProvider";
#endif
- if (!CreateAutomationProvider<TestingAutomationProvider>(
- testing_channel_id,
- last_used_profile,
- static_cast<size_t>(expected_tab_count)))
- return false;
- }
+ if (!CreateAutomationProvider<TestingAutomationProvider>(
+ testing_channel_id,
+ last_used_profile,
+ static_cast<size_t>(expected_tab_count)))
+ return false;
}
- bool silent_launch = false;
-
if (command_line.HasSwitch(switches::kAutomationClientChannelID)) {
std::string automation_channel_id = command_line.GetSwitchValueASCII(
switches::kAutomationClientChannelID);
@@ -1785,6 +1787,7 @@ bool BrowserInit::ProcessCmdLineImpl(
return false;
}
}
+#endif // defined(ENABLE_AUTOMATION)
// If we have been invoked to display a desktop notification on behalf of
// the service process, we do not want to open any browser windows.
@@ -1905,6 +1908,7 @@ template <class AutomationProviderClass>
bool BrowserInit::CreateAutomationProvider(const std::string& channel_id,
Profile* profile,
size_t expected_tabs) {
+#if defined(ENABLE_AUTOMATION)
scoped_refptr<AutomationProviderClass> automation =
new AutomationProviderClass(profile);
#if defined(OS_CHROMEOS)
@@ -1918,6 +1922,7 @@ bool BrowserInit::CreateAutomationProvider(const std::string& channel_id,
AutomationProviderList* list = g_browser_process->GetAutomationProviderList();
DCHECK(list);
list->AddProvider(automation);
+#endif // defined(ENABLE_AUTOMATION)
return true;
}
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index 3333697..d5171e4 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -81,7 +81,9 @@ TabContentsWrapper::TabContentsWrapper(WebContents* contents)
autocomplete_history_manager_->SetExternalDelegate(
autofill_external_delegate_.get());
}
+#if defined(ENABLE_AUTOMATION)
automation_tab_helper_.reset(new AutomationTabHelper(contents));
+#endif
blocked_content_tab_helper_.reset(new BlockedContentTabHelper(this));
bookmark_tab_helper_.reset(new BookmarkTabHelper(this));
constrained_window_tab_helper_.reset(new ConstrainedWindowTabHelper(this));
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 08709d6..cdf9a0e 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -4463,6 +4463,11 @@
['exclude', '^browser/themes/'],
],
}],
+ ['enable_automation!=1', {
+ 'sources/': [
+ ['exclude', '^browser/automation/'],
+ ],
+ }],
['OS=="android"', {
'sources!': [
'browser/bookmarks/bookmark_context_menu_controller.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 18833df..dcbee8d 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -2190,6 +2190,11 @@
['exclude', '^renderer/safe_browsing/'],
],
}],
+ ['enable_automation!=1', {
+ 'sources/': [
+ ['exclude', '^browser/automation/'],
+ ],
+ }],
['chromeos==1', {
'sources/': [
['exclude', '^browser/password_manager/native_backend_gnome_x_unittest.cc'],
@@ -4272,7 +4277,7 @@
], # OS=="win"
# If you change this condition, make sure you also change it in all.gyp
# for the chromium_builder_qa target.
- ['OS == "mac" or OS == "win" or (os_posix == 1 and OS != "android" and target_arch == python_arch)', {
+ ['enable_automation==1 and (OS=="mac" or OS=="win" or (os_posix==1 and target_arch==python_arch))', {
'targets': [
{
# Documentation: http://dev.chromium.org/developers/testing/pyauto