summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 19:42:29 +0000
committerdtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 19:42:29 +0000
commitff52c165aa2d4b98f9a11208ef8d22866aeb407b (patch)
treed828f81ade4ea7b930cc2292ef08894913079104
parent3bba9de6d9097f02102ee3f8e7f6ab56f8ab31a7 (diff)
downloadchromium_src-ff52c165aa2d4b98f9a11208ef8d22866aeb407b.zip
chromium_src-ff52c165aa2d4b98f9a11208ef8d22866aeb407b.tar.gz
chromium_src-ff52c165aa2d4b98f9a11208ef8d22866aeb407b.tar.bz2
- Add ChromeOS login and lock screen automation hooks.
- Add AutomationProxy::SendJSONRequest that does not require a handle to a Browser/BrowserProxy. - Fix issue where AutomationProvider thinks it's never finished loading the login screen. - Not included: UI tests for login, since they should be PyAuto tests. - Not included: fix for Chrome quitting as a result of channel disconnect. BUG=chromium-os:11538 TEST=none Review URL: http://codereview.chromium.org/6320022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73327 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_provider.cc4
-rw-r--r--chrome/browser/automation/automation_provider.h8
-rw-r--r--chrome/browser/automation/automation_provider_chromeos.cc22
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc12
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc162
-rw-r--r--chrome/browser/automation/testing_automation_provider.h19
-rw-r--r--chrome/browser/automation/testing_automation_provider_chromeos.cc65
-rw-r--r--chrome/browser/ui/browser_init.cc6
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/test/automation/automation_proxy.cc9
-rw-r--r--chrome/test/automation/automation_proxy.h4
-rw-r--r--chrome/test/automation/browser_proxy.h2
12 files changed, 205 insertions, 110 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 294ba39..dbd31cb 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -424,10 +424,6 @@ bool AutomationProvider::OnMessageReceived(const IPC::Message& message) {
OnRunUnloadHandlers)
IPC_MESSAGE_HANDLER(AutomationMsg_SetZoomLevel, OnSetZoomLevel)
#endif // defined(OS_WIN)
-#if defined(OS_CHROMEOS)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_LoginWithUserAndPass,
- LoginWithUserAndPass)
-#endif // defined(OS_CHROMEOS)
IPC_MESSAGE_UNHANDLED(handled = false;OnUnhandledMessage())
IPC_END_MESSAGE_MAP()
return handled;
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index d558c45..a10d71a 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -325,14 +325,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
void StopAsync(int tab_handle);
void SaveAsAsync(int tab_handle);
-#if defined(OS_CHROMEOS)
- // Logs in through the Chrome OS Login Wizard with given |username| and
- // password. Returns true via |reply_message| on success.
- void LoginWithUserAndPass(const std::string& username,
- const std::string& password,
- IPC::Message* reply_message);
-#endif
-
// Returns the extension for the given handle. Returns NULL if there is
// no extension for the handle.
const Extension* GetExtension(int extension_handle);
diff --git a/chrome/browser/automation/automation_provider_chromeos.cc b/chrome/browser/automation/automation_provider_chromeos.cc
deleted file mode 100644
index c0bd8b4..0000000
--- a/chrome/browser/automation/automation_provider_chromeos.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2010 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 "chrome/browser/automation/automation_provider.h"
-
-#include "chrome/browser/automation/automation_provider_observers.h"
-#include "chrome/browser/chromeos/login/existing_user_controller.h"
-
-using chromeos::ExistingUserController;
-
-void AutomationProvider::LoginWithUserAndPass(const std::string& username,
- const std::string& password,
- IPC::Message* reply_message) {
- ExistingUserController* controller =
- ExistingUserController::current_controller();
-
- // Set up an observer (it will delete itself).
- new LoginManagerObserver(this, reply_message);
-
- controller->Login(username, password);
-}
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index f496a7a..11d6b43 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -1144,18 +1144,20 @@ LoginManagerObserver::LoginManagerObserver(
: automation_(automation),
reply_message_(reply_message) {
- registrar_.Add(this, NotificationType::LOGIN_AUTHENTICATION,
+ registrar_.Add(this, NotificationType::LOGIN_USER_CHANGED,
NotificationService::AllSources());
}
void LoginManagerObserver::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NotificationType::LOGIN_AUTHENTICATION);
+ DCHECK(type == NotificationType::LOGIN_USER_CHANGED);
+ AutomationJSONReply reply(automation_, reply_message_);
Details<AuthenticationNotificationDetails> auth_details(details);
- AutomationMsg_LoginWithUserAndPass::WriteReplyParams(reply_message_,
- auth_details->success());
- automation_->Send(reply_message_);
+ if (auth_details->success())
+ reply.SendSuccess(NULL);
+ else
+ reply.SendError("Login failure.");
delete this;
}
#endif
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 04709ff..2d86dda 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -1942,17 +1942,7 @@ void TestingAutomationProvider::CaptureEntirePageAsPNG(
void TestingAutomationProvider::SendJSONRequest(int handle,
std::string json_request,
IPC::Message* reply_message) {
- Browser* browser = NULL;
scoped_ptr<Value> values;
-
- // Basic error checking.
- if (browser_tracker_->ContainsHandle(handle)) {
- browser = browser_tracker_->GetResource(handle);
- }
- if (!browser) {
- AutomationJSONReply(this, reply_message).SendError("no browser object");
- return;
- }
base::JSONReader reader;
std::string error;
values.reset(reader.ReadAndReturnError(json_request, true, NULL, &error));
@@ -1978,136 +1968,172 @@ void TestingAutomationProvider::SendJSONRequest(int handle,
// Map json commands to their handlers.
std::map<std::string, JsonHandler> handler_map;
- handler_map["DisablePlugin"] = &TestingAutomationProvider::DisablePlugin;
- handler_map["EnablePlugin"] = &TestingAutomationProvider::EnablePlugin;
- handler_map["GetPluginsInfo"] = &TestingAutomationProvider::GetPluginsInfo;
-
- handler_map["GetBrowserInfo"] = &TestingAutomationProvider::GetBrowserInfo;
-
- handler_map["GetNavigationInfo"] =
+#if defined(OS_CHROMEOS)
+ handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest;
+ handler_map["Login"] = &TestingAutomationProvider::Login;
+ handler_map["Logout"] = &TestingAutomationProvider::Logout;
+ handler_map["ScreenLock"] = &TestingAutomationProvider::ScreenLock;
+ handler_map["ScreenUnlock"] = &TestingAutomationProvider::ScreenUnlock;
+#endif // defined(OS_CHROMEOS)
+
+ std::map<std::string, BrowserJsonHandler> browser_handler_map;
+ browser_handler_map["DisablePlugin"] =
+ &TestingAutomationProvider::DisablePlugin;
+ browser_handler_map["EnablePlugin"] =
+ &TestingAutomationProvider::EnablePlugin;
+ browser_handler_map["GetPluginsInfo"] =
+ &TestingAutomationProvider::GetPluginsInfo;
+
+ browser_handler_map["GetBrowserInfo"] =
+ &TestingAutomationProvider::GetBrowserInfo;
+
+ browser_handler_map["GetNavigationInfo"] =
&TestingAutomationProvider::GetNavigationInfo;
- handler_map["PerformActionOnInfobar"] =
+ browser_handler_map["PerformActionOnInfobar"] =
&TestingAutomationProvider::PerformActionOnInfobar;
- handler_map["GetHistoryInfo"] = &TestingAutomationProvider::GetHistoryInfo;
- handler_map["AddHistoryItem"] = &TestingAutomationProvider::AddHistoryItem;
+ browser_handler_map["GetHistoryInfo"] =
+ &TestingAutomationProvider::GetHistoryInfo;
+ browser_handler_map["AddHistoryItem"] =
+ &TestingAutomationProvider::AddHistoryItem;
- handler_map["GetOmniboxInfo"] = &TestingAutomationProvider::GetOmniboxInfo;
- handler_map["SetOmniboxText"] = &TestingAutomationProvider::SetOmniboxText;
- handler_map["OmniboxAcceptInput"] =
+ browser_handler_map["GetOmniboxInfo"] =
+ &TestingAutomationProvider::GetOmniboxInfo;
+ browser_handler_map["SetOmniboxText"] =
+ &TestingAutomationProvider::SetOmniboxText;
+ browser_handler_map["OmniboxAcceptInput"] =
&TestingAutomationProvider::OmniboxAcceptInput;
- handler_map["OmniboxMovePopupSelection"] =
+ browser_handler_map["OmniboxMovePopupSelection"] =
&TestingAutomationProvider::OmniboxMovePopupSelection;
- handler_map["GetInstantInfo"] = &TestingAutomationProvider::GetInstantInfo;
+ browser_handler_map["GetInstantInfo"] =
+ &TestingAutomationProvider::GetInstantInfo;
- handler_map["LoadSearchEngineInfo"] =
+ browser_handler_map["LoadSearchEngineInfo"] =
&TestingAutomationProvider::LoadSearchEngineInfo;
- handler_map["GetSearchEngineInfo"] =
+ browser_handler_map["GetSearchEngineInfo"] =
&TestingAutomationProvider::GetSearchEngineInfo;
- handler_map["AddOrEditSearchEngine"] =
+ browser_handler_map["AddOrEditSearchEngine"] =
&TestingAutomationProvider::AddOrEditSearchEngine;
- handler_map["PerformActionOnSearchEngine"] =
+ browser_handler_map["PerformActionOnSearchEngine"] =
&TestingAutomationProvider::PerformActionOnSearchEngine;
- handler_map["GetPrefsInfo"] = &TestingAutomationProvider::GetPrefsInfo;
- handler_map["SetPrefs"] = &TestingAutomationProvider::SetPrefs;
+ browser_handler_map["GetPrefsInfo"] =
+ &TestingAutomationProvider::GetPrefsInfo;
+ browser_handler_map["SetPrefs"] = &TestingAutomationProvider::SetPrefs;
- handler_map["SetWindowDimensions"] =
+ browser_handler_map["SetWindowDimensions"] =
&TestingAutomationProvider::SetWindowDimensions;
- handler_map["GetDownloadsInfo"] =
+ browser_handler_map["GetDownloadsInfo"] =
&TestingAutomationProvider::GetDownloadsInfo;
- handler_map["WaitForAllDownloadsToComplete"] =
+ browser_handler_map["WaitForAllDownloadsToComplete"] =
&TestingAutomationProvider::WaitForDownloadsToComplete;
- handler_map["PerformActionOnDownload"] =
+ browser_handler_map["PerformActionOnDownload"] =
&TestingAutomationProvider::PerformActionOnDownload;
- handler_map["GetInitialLoadTimes"] =
+ browser_handler_map["GetInitialLoadTimes"] =
&TestingAutomationProvider::GetInitialLoadTimes;
- handler_map["SaveTabContents"] = &TestingAutomationProvider::SaveTabContents;
+ browser_handler_map["SaveTabContents"] =
+ &TestingAutomationProvider::SaveTabContents;
- handler_map["ImportSettings"] = &TestingAutomationProvider::ImportSettings;
+ browser_handler_map["ImportSettings"] =
+ &TestingAutomationProvider::ImportSettings;
- handler_map["AddSavedPassword"] =
+ browser_handler_map["AddSavedPassword"] =
&TestingAutomationProvider::AddSavedPassword;
- handler_map["RemoveSavedPassword"] =
+ browser_handler_map["RemoveSavedPassword"] =
&TestingAutomationProvider::RemoveSavedPassword;
- handler_map["GetSavedPasswords"] =
+ browser_handler_map["GetSavedPasswords"] =
&TestingAutomationProvider::GetSavedPasswords;
- handler_map["ClearBrowsingData"] =
+ browser_handler_map["ClearBrowsingData"] =
&TestingAutomationProvider::ClearBrowsingData;
- handler_map["GetBlockedPopupsInfo"] =
+ browser_handler_map["GetBlockedPopupsInfo"] =
&TestingAutomationProvider::GetBlockedPopupsInfo;
- handler_map["UnblockAndLaunchBlockedPopup"] =
+ browser_handler_map["UnblockAndLaunchBlockedPopup"] =
&TestingAutomationProvider::UnblockAndLaunchBlockedPopup;
// SetTheme() implemented using InstallExtension().
- handler_map["GetThemeInfo"] = &TestingAutomationProvider::GetThemeInfo;
+ browser_handler_map["GetThemeInfo"] =
+ &TestingAutomationProvider::GetThemeInfo;
// InstallExtension() present in pyauto.py.
- handler_map["GetExtensionsInfo"] =
+ browser_handler_map["GetExtensionsInfo"] =
&TestingAutomationProvider::GetExtensionsInfo;
- handler_map["UninstallExtensionById"] =
+ browser_handler_map["UninstallExtensionById"] =
&TestingAutomationProvider::UninstallExtensionById;
- handler_map["FindInPage"] = &TestingAutomationProvider::FindInPage;
+ browser_handler_map["FindInPage"] = &TestingAutomationProvider::FindInPage;
- handler_map["SelectTranslateOption"] =
+ browser_handler_map["SelectTranslateOption"] =
&TestingAutomationProvider::SelectTranslateOption;
- handler_map["GetTranslateInfo"] =
+ browser_handler_map["GetTranslateInfo"] =
&TestingAutomationProvider::GetTranslateInfo;
- handler_map["GetAutoFillProfile"] =
+ browser_handler_map["GetAutoFillProfile"] =
&TestingAutomationProvider::GetAutoFillProfile;
- handler_map["FillAutoFillProfile"] =
+ browser_handler_map["FillAutoFillProfile"] =
&TestingAutomationProvider::FillAutoFillProfile;
- handler_map["GetActiveNotifications"] =
+ browser_handler_map["GetActiveNotifications"] =
&TestingAutomationProvider::GetActiveNotifications;
- handler_map["CloseNotification"] =
+ browser_handler_map["CloseNotification"] =
&TestingAutomationProvider::CloseNotification;
- handler_map["WaitForNotificationCount"] =
+ browser_handler_map["WaitForNotificationCount"] =
&TestingAutomationProvider::WaitForNotificationCount;
- handler_map["SignInToSync"] = &TestingAutomationProvider::SignInToSync;
- handler_map["GetSyncInfo"] = &TestingAutomationProvider::GetSyncInfo;
- handler_map["AwaitSyncCycleCompletion"] =
+ browser_handler_map["SignInToSync"] =
+ &TestingAutomationProvider::SignInToSync;
+ browser_handler_map["GetSyncInfo"] = &TestingAutomationProvider::GetSyncInfo;
+ browser_handler_map["AwaitSyncCycleCompletion"] =
&TestingAutomationProvider::AwaitSyncCycleCompletion;
- handler_map["EnableSyncForDatatypes"] =
+ browser_handler_map["EnableSyncForDatatypes"] =
&TestingAutomationProvider::EnableSyncForDatatypes;
- handler_map["DisableSyncForDatatypes"] =
+ browser_handler_map["DisableSyncForDatatypes"] =
&TestingAutomationProvider::DisableSyncForDatatypes;
- handler_map["GetNTPInfo"] =
+ browser_handler_map["GetNTPInfo"] =
&TestingAutomationProvider::GetNTPInfo;
- handler_map["MoveNTPMostVisitedThumbnail"] =
+ browser_handler_map["MoveNTPMostVisitedThumbnail"] =
&TestingAutomationProvider::MoveNTPMostVisitedThumbnail;
- handler_map["RemoveNTPMostVisitedThumbnail"] =
+ browser_handler_map["RemoveNTPMostVisitedThumbnail"] =
&TestingAutomationProvider::RemoveNTPMostVisitedThumbnail;
- handler_map["UnpinNTPMostVisitedThumbnail"] =
+ browser_handler_map["UnpinNTPMostVisitedThumbnail"] =
&TestingAutomationProvider::UnpinNTPMostVisitedThumbnail;
- handler_map["RestoreAllNTPMostVisitedThumbnails"] =
+ browser_handler_map["RestoreAllNTPMostVisitedThumbnails"] =
&TestingAutomationProvider::RestoreAllNTPMostVisitedThumbnails;
- handler_map["KillRendererProcess"] =
+ browser_handler_map["KillRendererProcess"] =
&TestingAutomationProvider::KillRendererProcess;
- handler_map["SendKeyEventToActiveTab"] =
+ browser_handler_map["SendKeyEventToActiveTab"] =
&TestingAutomationProvider::SendKeyEventToActiveTab;
if (handler_map.find(std::string(command)) != handler_map.end()) {
- (this->*handler_map[command])(browser, dict_value, reply_message);
+ (this->*handler_map[command])(dict_value, reply_message);
+ } else if (browser_handler_map.find(std::string(command)) !=
+ browser_handler_map.end()) {
+ Browser* browser = NULL;
+ if (!browser_tracker_->ContainsHandle(handle) ||
+ !(browser = browser_tracker_->GetResource(handle))) {
+ AutomationJSONReply(this, reply_message).SendError("No browser object.");
+ return;
+ }
+ (this->*browser_handler_map[command])(browser, dict_value, reply_message);
} else {
std::string error_string = "Unknown command. Options: ";
for (std::map<std::string, JsonHandler>::const_iterator it =
handler_map.begin(); it != handler_map.end(); ++it) {
error_string += it->first + ", ";
}
+ for (std::map<std::string, BrowserJsonHandler>::const_iterator it =
+ browser_handler_map.begin(); it != browser_handler_map.end(); ++it) {
+ error_string += it->first + ", ";
+ }
AutomationJSONReply(this, reply_message).SendError(error_string);
}
}
diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h
index 98c272e..01d2fdc 100644
--- a/chrome/browser/automation/testing_automation_provider.h
+++ b/chrome/browser/automation/testing_automation_provider.h
@@ -372,7 +372,12 @@ class TestingAutomationProvider : public AutomationProvider,
// Method ptr for json handlers.
// Uses the JSON interface for input/output.
- typedef void (TestingAutomationProvider::*JsonHandler)(
+ typedef void (TestingAutomationProvider::*JsonHandler)(DictionaryValue*,
+ IPC::Message*);
+
+ // Method ptr for json handlers that take a browser argument.
+ // Uses the JSON interface for input/output.
+ typedef void (TestingAutomationProvider::*BrowserJsonHandler)(
Browser* browser,
DictionaryValue*,
IPC::Message*);
@@ -757,6 +762,18 @@ class TestingAutomationProvider : public AutomationProvider,
DictionaryValue* args,
IPC::Message* reply_message);
+#if defined(OS_CHROMEOS)
+ void LoginAsGuest(DictionaryValue* args, IPC::Message* reply_message);
+
+ void Login(DictionaryValue* args, IPC::Message* reply_message);
+
+ void Logout(DictionaryValue* args, IPC::Message* reply_message);
+
+ void ScreenLock(DictionaryValue* args, IPC::Message* reply_message);
+
+ void ScreenUnlock(DictionaryValue* args, IPC::Message* reply_message);
+#endif // defined(OS_CHROMEOS)
+
void WaitForTabCountToBecome(int browser_handle,
int target_tab_count,
IPC::Message* reply_message);
diff --git a/chrome/browser/automation/testing_automation_provider_chromeos.cc b/chrome/browser/automation/testing_automation_provider_chromeos.cc
new file mode 100644
index 0000000..4b891ce
--- /dev/null
+++ b/chrome/browser/automation/testing_automation_provider_chromeos.cc
@@ -0,0 +1,65 @@
+// Copyright (c) 2011 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 "chrome/browser/automation/testing_automation_provider.h"
+
+#include "base/values.h"
+#include "chrome/browser/automation/automation_provider_json.h"
+#include "chrome/browser/automation/automation_provider_observers.h"
+#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/screen_lock_library.h"
+#include "chrome/browser/chromeos/login/existing_user_controller.h"
+
+void TestingAutomationProvider::LoginAsGuest(DictionaryValue* args,
+ IPC::Message* reply_message) {
+ chromeos::ExistingUserController* controller =
+ chromeos::ExistingUserController::current_controller();
+ // Set up an observer (it will delete itself).
+ new LoginManagerObserver(this, reply_message);
+ controller->LoginAsGuest();
+}
+
+void TestingAutomationProvider::Login(DictionaryValue* args,
+ IPC::Message* reply_message) {
+ std::string username, password;
+ if (!args->GetString("username", &username) ||
+ !args->GetString("password", &password)) {
+ AutomationJSONReply(this, reply_message).SendError(
+ "Invalid or missing args");
+ return;
+ }
+
+ chromeos::ExistingUserController* controller =
+ chromeos::ExistingUserController::current_controller();
+ // Set up an observer (it will delete itself).
+ new LoginManagerObserver(this, reply_message);
+ controller->Login(username, password);
+}
+
+// Logging out could have other undesirable side effects: session_manager is
+// killed, so its children, including chrome and the window manager will also
+// be killed. SSH connections might be closed, the test binary might be killed.
+void TestingAutomationProvider::Logout(DictionaryValue* args,
+ IPC::Message* reply_message) {
+ // Send success before stopping session because if we're a child of
+ // session manager then we'll die when the session is stopped.
+ AutomationJSONReply(this, reply_message).SendSuccess(NULL);
+ if (chromeos::CrosLibrary::Get()->EnsureLoaded())
+ chromeos::CrosLibrary::Get()->GetLoginLibrary()->StopSession("");
+}
+
+void TestingAutomationProvider::ScreenLock(DictionaryValue* args,
+ IPC::Message* reply_message) {
+ chromeos::CrosLibrary::Get()->GetScreenLockLibrary()->
+ NotifyScreenLockRequested();
+ AutomationJSONReply(this, reply_message).SendSuccess(NULL);
+}
+
+void TestingAutomationProvider::ScreenUnlock(DictionaryValue* args,
+ IPC::Message* reply_message) {
+ chromeos::CrosLibrary::Get()->GetScreenLockLibrary()->
+ NotifyScreenUnlockRequested();
+ AutomationJSONReply(this, reply_message).SendSuccess(NULL);
+}
+
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 8df358f..a2fefdf 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -1099,6 +1099,12 @@ bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line,
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;
+#endif
} else if (command_line.HasSwitch(switches::kRestoreLastSession)) {
std::string restore_session_value(
command_line.GetSwitchValueASCII(switches::kRestoreLastSession));
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 3e72efe..70407db 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -230,7 +230,6 @@
'browser/automation/automation_extension_tracker.h',
'browser/automation/automation_provider.cc',
'browser/automation/automation_provider.h',
- 'browser/automation/automation_provider_chromeos.cc',
'browser/automation/automation_provider_gtk.cc',
'browser/automation/automation_provider_json.cc',
'browser/automation/automation_provider_json.h',
@@ -260,6 +259,7 @@
'browser/automation/extension_port_container.h',
'browser/automation/testing_automation_provider.cc',
'browser/automation/testing_automation_provider.h',
+ 'browser/automation/testing_automation_provider_chromeos.cc',
'browser/automation/testing_automation_provider_gtk.cc',
'browser/automation/testing_automation_provider_mac.mm',
'browser/automation/testing_automation_provider_views.cc',
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 461b3e4..6aa64b3 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -551,3 +551,12 @@ bool AutomationProxy::LoginWithUserAndPass(const std::string& username,
bool AutomationProxy::ResetToDefaultTheme() {
return Send(new AutomationMsg_ResetToDefaultTheme());
}
+
+bool AutomationProxy::SendJSONRequest(const std::string& request,
+ std::string* response) {
+ bool result = false;
+ return Send(new AutomationMsg_SendJSONRequest(
+ -1, request, response, &result));
+ return result;
+}
+
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index cfc8c8b..9770f3c 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -213,6 +213,10 @@ class AutomationProxy : public IPC::Channel::Listener,
// Resets to the default theme. Returns true on success.
bool ResetToDefaultTheme();
+ // Generic pattern for sending automation requests.
+ bool SendJSONRequest(const std::string& request,
+ std::string* response) WARN_UNUSED_RESULT;
+
#if defined(OS_CHROMEOS)
// Logs in through the Chrome OS login wizard with given |username|
// and |password|. Returns true on success.
diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h
index 6d0d215..7d77949 100644
--- a/chrome/test/automation/browser_proxy.h
+++ b/chrome/test/automation/browser_proxy.h
@@ -221,7 +221,7 @@ class BrowserProxy : public AutomationResourceProxy {
bool StartTrackingPopupMenus() WARN_UNUSED_RESULT;
bool WaitForPopupMenuToOpen() WARN_UNUSED_RESULT;
- // Experimental generic pattern.
+ // Generic pattern for sending automation requests.
bool SendJSONRequest(const std::string& request,
std::string* response) WARN_UNUSED_RESULT;