Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 10590004: [cros] Fake a stub user login when no --login-manager and --login-user are given. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments and mock expectations. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/chrome_browser_main_chromeos.cc
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index 9734a30459611f7d37a1e44451522ff7abcc443d..ee026c004d5328994428168f53e30d01ee824ee3 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -78,6 +78,13 @@
#include "net/base/network_change_notifier.h"
#include "net/url_request/url_request.h"
+namespace {
+
+// Username for stub login when not running on ChromeOS.
+const char kStubUsername[] = "stub-user@example.com";
+
+}
+
class MessageLoopObserver : public MessageLoopForUI::Observer {
virtual base::EventStatus WillProcessEvent(
const base::NativeEvent& event) OVERRIDE {
@@ -229,14 +236,33 @@ ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() {
// content::BrowserMainParts and ChromeBrowserMainExtraParts overrides ---------
void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() {
+ CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
+
if (parsed_command_line().HasSwitch(switches::kGuestSession)) {
// Disable sync and extensions if we're in "browse without sign-in" mode.
- CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
singleton_command_line->AppendSwitch(switches::kDisableSync);
singleton_command_line->AppendSwitch(switches::kDisableExtensions);
browser_defaults::bookmarks_enabled = false;
}
+ // If we're not running on real ChromeOS hardware (or under VM), and are not
+ // showing the login manager or attempting a command line login, login with a
+ // stub user.
+ if (!base::chromeos::IsRunningOnChromeOS() &&
+ !parsed_command_line().HasSwitch(switches::kLoginManager) &&
+ !parsed_command_line().HasSwitch(switches::kLoginUser) &&
+ !parsed_command_line().HasSwitch(switches::kGuestSession)) {
+ singleton_command_line->AppendSwitchASCII(switches::kLoginUser,
+ kStubUsername);
+ if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) {
+ singleton_command_line->AppendSwitchASCII(
+ switches::kLoginProfile, ProfileManager::kTestUserProfile);
+ }
+ LOG(INFO) << "Running as stub user with profile dir: "
+ << singleton_command_line->GetSwitchValuePath(
+ switches::kLoginProfile).value();
+ }
+
ChromeBrowserMainPartsLinux::PreEarlyInitialization();
}

Powered by Google App Engine
This is Rietveld 408576698