Index: chrome/browser/browser_main.cc |
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc |
index 6148e0c553444f458564ba16b6ffa6cd28d2f1c1..46d7efcca2d0e6c6832563be5fbe02f5c98eba89 100644 |
--- a/chrome/browser/browser_main.cc |
+++ b/chrome/browser/browser_main.cc |
@@ -1201,6 +1201,14 @@ int BrowserMain(const MainFunctionParams& parameters) { |
// Must happen before we try to use a message loop or display any UI. |
InitializeToolkit(parameters); |
+#if defined(OS_CHROMEOS) |
+ // Stub out chromeos implementations. We need to do as early as possible |
+ // because it is initialized on first use when it is initialized |
+ // SetUseStubImpl doesn't do anything. |
+ if (parameters.command_line_.HasSwitch(switches::kStubCros)) |
+ chromeos::CrosLibrary::Get()->GetTestApi()->SetUseStubImpl(); |
+#endif |
+ |
parts->MainMessageLoopStart(); |
// WARNING: If we get a WM_ENDSESSION, objects created on the stack here |
@@ -1530,10 +1538,6 @@ int BrowserMain(const MainFunctionParams& parameters) { |
// Profile creation ---------------------------------------------------------- |
#if defined(OS_CHROMEOS) |
- // Stub out chromeos implementations. |
- if (parsed_command_line.HasSwitch(switches::kStubCros)) |
- chromeos::CrosLibrary::Get()->GetTestApi()->SetUseStubImpl(); |
- |
// Initialize the screen locker now so that it can receive |
// LOGIN_USER_CHANGED notification from UserManager. |
chromeos::ScreenLocker::InitClass(); |