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

Side by Side Diff: chrome/browser/chromeos/login/kiosk_browsertest.cc

Issue 22914008: Refactor kiosk app launch to be part of login screen UI flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor style fixes Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chrome_browser_main.h" 9 #include "chrome/browser/chrome_browser_main.h"
10 #include "chrome/browser/chrome_browser_main_extra_parts.h" 10 #include "chrome/browser/chrome_browser_main_extra_parts.h"
11 #include "chrome/browser/chrome_content_browser_client.h" 11 #include "chrome/browser/chrome_content_browser_client.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" 13 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
14 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" 14 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
15 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" 15 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
16 #include "chrome/browser/chromeos/login/app_launch_controller.h"
16 #include "chrome/browser/chromeos/login/existing_user_controller.h" 17 #include "chrome/browser/chromeos/login/existing_user_controller.h"
17 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 18 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
18 #include "chrome/browser/chromeos/login/webui_login_display.h" 19 #include "chrome/browser/chromeos/login/webui_login_display.h"
19 #include "chrome/browser/chromeos/login/wizard_controller.h" 20 #include "chrome/browser/chromeos/login/wizard_controller.h"
20 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/extension_system.h" 22 #include "chrome/browser/extensions/extension_system.h"
22 #include "chrome/browser/lifetime/application_lifetime.h" 23 #include "chrome/browser/lifetime/application_lifetime.h"
23 #include "chrome/browser/prefs/scoped_user_pref_update.h" 24 #include "chrome/browser/prefs/scoped_user_pref_update.h"
24 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
25 #include "chrome/browser/ui/browser.h" 26 #include "chrome/browser/ui/browser.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Used to add an observer to NotificationService after it's created. 109 // Used to add an observer to NotificationService after it's created.
109 class KioskAppLaunchScenarioHandler : public TestBrowserMainExtraParts { 110 class KioskAppLaunchScenarioHandler : public TestBrowserMainExtraParts {
110 public: 111 public:
111 KioskAppLaunchScenarioHandler() {} 112 KioskAppLaunchScenarioHandler() {}
112 113
113 virtual ~KioskAppLaunchScenarioHandler() {} 114 virtual ~KioskAppLaunchScenarioHandler() {}
114 115
115 private: 116 private:
116 // ChromeBrowserMainExtraParts implementation. 117 // ChromeBrowserMainExtraParts implementation.
117 virtual void PreEarlyInitialization() OVERRIDE { 118 virtual void PreEarlyInitialization() OVERRIDE {
118 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
119 content::NotificationService::AllSources());
120 registrar_.Add(this, chrome::NOTIFICATION_KIOSK_APPS_LOADED, 119 registrar_.Add(this, chrome::NOTIFICATION_KIOSK_APPS_LOADED,
121 content::NotificationService::AllSources()); 120 content::NotificationService::AllSources());
122 registrar_.Add(this, chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, 121 registrar_.Add(this, chrome::NOTIFICATION_KIOSK_APP_LAUNCHED,
123 content::NotificationService::AllSources()); 122 content::NotificationService::AllSources());
124 } 123 }
125 124
126 // Overridden from content::NotificationObserver: 125 // Overridden from content::NotificationObserver:
127 virtual void Observe(int type, 126 virtual void Observe(int type,
128 const content::NotificationSource& source, 127 const content::NotificationSource& source,
129 const content::NotificationDetails& details) OVERRIDE { 128 const content::NotificationDetails& details) OVERRIDE {
130 if (type == chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE) { 129 if (type == chrome::NOTIFICATION_KIOSK_APPS_LOADED) {
131 LOG(INFO) << "NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE";
132 SetupSigninScreen();
133 } else if (type == chrome::NOTIFICATION_KIOSK_APPS_LOADED) {
134 LOG(INFO) << "chrome::NOTIFICATION_KIOSK_APPS_LOADED"; 130 LOG(INFO) << "chrome::NOTIFICATION_KIOSK_APPS_LOADED";
135 content::WebUI* web_ui = static_cast<chromeos::LoginDisplayHostImpl*>( 131 content::WebUI* web_ui = static_cast<chromeos::LoginDisplayHostImpl*>(
136 chromeos::LoginDisplayHostImpl::default_host())-> 132 chromeos::LoginDisplayHostImpl::default_host())->
137 GetOobeUI()->web_ui(); 133 GetOobeUI()->web_ui();
138 web_ui->CallJavascriptFunction("login.AppsMenuButton.runAppForTesting", 134 web_ui->CallJavascriptFunction("login.AppsMenuButton.runAppForTesting",
139 base::StringValue(kTestKioskApp)); 135 base::StringValue(kTestKioskApp));
140 } else if (type == chrome::NOTIFICATION_KIOSK_APP_LAUNCHED) { 136 } else if (type == chrome::NOTIFICATION_KIOSK_APP_LAUNCHED) {
141 LOG(INFO) << "chrome::NOTIFICATION_KIOSK_APP_LAUNCHED"; 137 LOG(INFO) << "chrome::NOTIFICATION_KIOSK_APP_LAUNCHED";
142 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 138 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
143 content::NotificationService::AllSources()); 139 content::NotificationService::AllSources());
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 535
540 // KioskTest overrides. 536 // KioskTest overrides.
541 virtual void InitializeKioskTest() OVERRIDE { 537 virtual void InitializeKioskTest() OVERRIDE {
542 content_browser_client_.reset( 538 content_browser_client_.reset(
543 new TestContentBrowserClient(TestContentBrowserClient::KioskAppLaunch)); 539 new TestContentBrowserClient(TestContentBrowserClient::KioskAppLaunch));
544 } 540 }
545 }; 541 };
546 542
547 IN_PROC_BROWSER_TEST_P(KioskLaunchTest, InstallAndLaunchApp) { 543 IN_PROC_BROWSER_TEST_P(KioskLaunchTest, InstallAndLaunchApp) {
548 EnableConsumerKioskMode(); 544 EnableConsumerKioskMode();
545 chromeos::AppLaunchController::SkipSplashWaitForTesting();
549 // Start UI, find menu entry for this app and launch it. 546 // Start UI, find menu entry for this app and launch it.
550 chromeos::WizardController::SkipPostLoginScreensForTesting(); 547 chromeos::WizardController::SkipPostLoginScreensForTesting();
551 chromeos::WizardController* wizard_controller = 548 chromeos::WizardController* wizard_controller =
552 chromeos::WizardController::default_controller(); 549 chromeos::WizardController::default_controller();
553 CHECK(wizard_controller); 550 CHECK(wizard_controller);
554 wizard_controller->SkipToLoginForTesting(); 551 wizard_controller->SkipToLoginForTesting();
555 552
556 ReloadKioskApps(); 553 ReloadKioskApps();
557 554
558 // The first loop exits after we receive NOTIFICATION_KIOSK_APP_LAUNCHED 555 // The first loop exits after we receive NOTIFICATION_KIOSK_APP_LAUNCHED
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 844
848 INSTANTIATE_TEST_CASE_P(KioskEnableCancelTestInstantiation, 845 INSTANTIATE_TEST_CASE_P(KioskEnableCancelTestInstantiation,
849 KioskEnableCancelTest, 846 KioskEnableCancelTest,
850 testing::Bool()); 847 testing::Bool());
851 848
852 INSTANTIATE_TEST_CASE_P(KioskEnableConfirmedTestInstantiation, 849 INSTANTIATE_TEST_CASE_P(KioskEnableConfirmedTestInstantiation,
853 KioskEnableConfirmedTest, 850 KioskEnableConfirmedTest,
854 testing::Bool()); 851 testing::Bool());
855 852
856 } // namespace chromeos 853 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698