Commit c85a9a17 authored by satorux@chromium.org's avatar satorux@chromium.org

chromeos: Fix test failures in LoginUtils*

IsRunningOnChromeOS() turned out to be unnecessary.
CrosLibrary::EnsureLoaded() was returning true before crrev.com/110516,
as ScopedStubCrosEnabler was used in LoginUtilsTestBase.

BUG=chromium-os:23154
TEST=run linux_chromeos try bot


Review URL: http://codereview.chromium.org/8561004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110656 0039d316-1c4b-4281-b951-d872f2087c98
parent c9846903
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "chrome/browser/chromeos/login/parallel_authenticator.h" #include "chrome/browser/chromeos/login/parallel_authenticator.h"
#include "chrome/browser/chromeos/login/screen_locker.h" #include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/system/runtime_environment.h"
#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/net/chrome_url_request_context.h"
...@@ -641,12 +640,10 @@ void LoginUtilsImpl::PrepareProfile( ...@@ -641,12 +640,10 @@ void LoginUtilsImpl::PrepareProfile(
VLOG(1) << "Completing login for " << username; VLOG(1) << "Completing login for " << username;
if (system::runtime_environment::IsRunningOnChromeOS()) { btl->AddLoginTimeMarker("StartSession-Start", false);
btl->AddLoginTimeMarker("StartSession-Start", false); DBusThreadManager::Get()->GetSessionManagerClient()->StartSession(
DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( username);
username); btl->AddLoginTimeMarker("StartSession-End", false);
btl->AddLoginTimeMarker("StartSession-End", false);
}
btl->AddLoginTimeMarker("UserLoggedIn-Start", false); btl->AddLoginTimeMarker("UserLoggedIn-Start", false);
UserManager::Get()->UserLoggedIn(username); UserManager::Get()->UserLoggedIn(username);
...@@ -806,18 +803,16 @@ void LoginUtilsImpl::OnProfileCreated(Profile* user_profile, Status status) { ...@@ -806,18 +803,16 @@ void LoginUtilsImpl::OnProfileCreated(Profile* user_profile, Status status) {
// Own TPM device if, for any reason, it has not been done in EULA // Own TPM device if, for any reason, it has not been done in EULA
// wizard screen. // wizard screen.
if (system::runtime_environment::IsRunningOnChromeOS()) { CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary();
CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary(); btl->AddLoginTimeMarker("TPMOwn-Start", false);
btl->AddLoginTimeMarker("TPMOwn-Start", false); if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) {
if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) { if (cryptohome->TpmIsOwned()) {
if (cryptohome->TpmIsOwned()) { cryptohome->TpmClearStoredPassword();
cryptohome->TpmClearStoredPassword(); } else {
} else { cryptohome->TpmCanAttemptOwnership();
cryptohome->TpmCanAttemptOwnership();
}
} }
btl->AddLoginTimeMarker("TPMOwn-End", false);
} }
btl->AddLoginTimeMarker("TPMOwn-End", false);
user_profile->OnLogin(); user_profile->OnLogin();
...@@ -924,27 +919,25 @@ void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) { ...@@ -924,27 +919,25 @@ void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) {
UserManager::Get()->GuestUserLoggedIn(); UserManager::Get()->GuestUserLoggedIn();
if (system::runtime_environment::IsRunningOnChromeOS()) { // Session Manager may kill the chrome anytime after this point.
// Session Manager may kill the chrome anytime after this point. // Write exit_cleanly and other stuff to the disk here.
// Write exit_cleanly and other stuff to the disk here. g_browser_process->EndSession();
g_browser_process->EndSession();
// For guest session we ask session manager to restart Chrome with --bwsi
// For guest session we ask session manager to restart Chrome with --bwsi // flag. We keep only some of the arguments of this process.
// flag. We keep only some of the arguments of this process. const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); CommandLine command_line(browser_command_line.GetProgram());
CommandLine command_line(browser_command_line.GetProgram()); std::string cmd_line_str =
std::string cmd_line_str = GetOffTheRecordCommandLine(start_url,
GetOffTheRecordCommandLine(start_url, browser_command_line,
browser_command_line, &command_line);
&command_line);
if (job_restart_request_) {
if (job_restart_request_) { NOTREACHED();
NOTREACHED();
}
VLOG(1) << "Requesting a restart with PID " << getpid()
<< " and command line: " << cmd_line_str;
job_restart_request_ = new JobRestartRequest(getpid(), cmd_line_str);
} }
VLOG(1) << "Requesting a restart with PID " << getpid()
<< " and command line: " << cmd_line_str;
job_restart_request_ = new JobRestartRequest(getpid(), cmd_line_str);
} }
std::string LoginUtilsImpl::GetOffTheRecordCommandLine( std::string LoginUtilsImpl::GetOffTheRecordCommandLine(
...@@ -1099,17 +1092,15 @@ class WarmingObserver : public NetworkLibrary::NetworkManagerObserver { ...@@ -1099,17 +1092,15 @@ class WarmingObserver : public NetworkLibrary::NetworkManagerObserver {
}; };
void LoginUtilsImpl::PrewarmAuthentication() { void LoginUtilsImpl::PrewarmAuthentication() {
if (system::runtime_environment::IsRunningOnChromeOS()) { NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary();
NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); if (network->Connected()) {
if (network->Connected()) { const int kConnectionsNeeded = 1;
const int kConnectionsNeeded = 1; chrome_browser_net::PreconnectOnUIThread(
chrome_browser_net::PreconnectOnUIThread( GURL(GaiaUrls::GetInstance()->client_login_url()),
GURL(GaiaUrls::GetInstance()->client_login_url()), chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED,
chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, kConnectionsNeeded);
kConnectionsNeeded); } else {
} else { new WarmingObserver();
new WarmingObserver();
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment