Index: chrome/browser/chromeos/login/app_launch_controller.cc |
diff --git a/chrome/browser/chromeos/login/app_launch_controller.cc b/chrome/browser/chromeos/login/app_launch_controller.cc |
index 72af235ec0aefea02c45a56b0cea8167cf83e341..6b187456b0be2a8ad6051b9a2fd5e00a9947c8dd 100644 |
--- a/chrome/browser/chromeos/login/app_launch_controller.cc |
+++ b/chrome/browser/chromeos/login/app_launch_controller.cc |
@@ -32,9 +32,6 @@ const int kAppInstallSplashScreenMinTimeMS = 3000; |
} // namespace |
-// static |
-bool AppLaunchController::skip_splash_wait_ = false; |
- |
AppLaunchController::AppLaunchController(const std::string& app_id, |
LoginDisplayHost* host, |
OobeDisplay* oobe_display) |
@@ -47,7 +44,12 @@ AppLaunchController::AppLaunchController(const std::string& app_id, |
error_screen_actor_(oobe_display_->GetErrorScreenActor()), |
waiting_for_network_(false), |
showing_network_dialog_(false), |
- launch_splash_start_time_(0) { |
+ launch_splash_start_time_(0), |
+ skip_splash_wait_for_testing_(false), |
+ network_wait_time_(10), |
+ user_manager_for_testing_(NULL) { |
+ signin_screen_.reset(new AppLaunchSigninScreen( |
+ static_cast<OobeUI*>(oobe_display_), this)); |
} |
AppLaunchController::~AppLaunchController() { |
@@ -66,18 +68,24 @@ void AppLaunchController::StartAppLaunch() { |
kiosk_profile_loader_->Start(); |
} |
-// static |
void AppLaunchController::SkipSplashWaitForTesting() { |
- skip_splash_wait_ = true; |
+ skip_splash_wait_for_testing_ = true; |
+} |
+ |
+void AppLaunchController::SetNetworkWaitForTesting(int wait_time_secs) { |
+ network_wait_time_ = wait_time_secs; |
+} |
+ |
+void AppLaunchController::SetUserManagerForTesting(UserManager* user_manager) { |
+ user_manager_for_testing_ = user_manager; |
+ signin_screen_->set_user_manager_for_testing(user_manager); |
} |
void AppLaunchController::OnConfigureNetwork() { |
DCHECK(profile_); |
showing_network_dialog_ = true; |
- const std::string& owner_email = UserManager::Get()->GetOwnerEmail(); |
+ const std::string& owner_email = GetUserManager()->GetOwnerEmail(); |
if (!owner_email.empty()) { |
- signin_screen_.reset(new AppLaunchSigninScreen( |
- static_cast<OobeUI*>(oobe_display_), this)); |
signin_screen_->Show(); |
} else { |
// If kiosk mode was configured through enterprise policy, we may |
@@ -145,10 +153,9 @@ void AppLaunchController::OnInitializingNetwork() { |
// Show the network configration dialog if network is not initialized |
// after a brief wait time. |
waiting_for_network_ = true; |
- const int kNetworkConfigWaitSeconds = 10; |
network_wait_timer_.Start( |
FROM_HERE, |
- base::TimeDelta::FromSeconds(kNetworkConfigWaitSeconds), |
+ base::TimeDelta::FromSeconds(network_wait_time_), |
this, &AppLaunchController::OnNetworkWaitTimedout); |
} |
@@ -157,6 +164,10 @@ void AppLaunchController::OnNetworkWaitTimedout() { |
LOG(WARNING) << "OnNetworkWaitTimedout... connection = " |
<< net::NetworkChangeNotifier::GetConnectionType(); |
app_launch_splash_screen_actor_->ToggleNetworkConfig(true); |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_KIOSK_APP_LAUNCH_NO_NETWORK, |
+ content::NotificationService::AllSources(), |
+ content::NotificationService::NoDetails()); |
} |
void AppLaunchController::OnInstallingApp() { |
@@ -182,7 +193,8 @@ void AppLaunchController::OnLaunchSucceeded() { |
// Enforce that we show app install splash screen for some minimum amount |
// of time. |
- if (!skip_splash_wait_ && time_taken_ms < kAppInstallSplashScreenMinTimeMS) { |
+ if (!skip_splash_wait_for_testing_ |
+ && time_taken_ms < kAppInstallSplashScreenMinTimeMS) { |
content::BrowserThread::PostDelayedTask( |
content::BrowserThread::UI, |
FROM_HERE, |
@@ -206,4 +218,9 @@ void AppLaunchController::OnLaunchFailed(KioskAppLaunchError::Error error) { |
Cleanup(); |
} |
+UserManager* AppLaunchController::GetUserManager() { |
+ return user_manager_for_testing_ ? |
+ user_manager_for_testing_ : UserManager::Get(); |
+} |
+ |
} // namespace chromeos |