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

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

Issue 294033002: Multi-profile flag cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Return --test-type flag back to profile_manager_unittest.cc Created 6 years, 7 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 "apps/app_window.h" 5 #include "apps/app_window.h"
6 #include "apps/app_window_registry.h" 6 #include "apps/app_window_registry.h"
7 #include "apps/ui/native_app_window.h" 7 #include "apps/ui/native_app_window.h"
8 #include "ash/desktop_background/desktop_background_controller.h" 8 #include "ash/desktop_background/desktop_background_controller.h"
9 #include "ash/desktop_background/desktop_background_controller_observer.h" 9 #include "ash/desktop_background/desktop_background_controller_observer.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/chromeos/profiles/profile_helper.h" 31 #include "chrome/browser/chromeos/profiles/profile_helper.h"
32 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" 32 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
33 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " 33 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h "
34 #include "chrome/browser/extensions/extension_service.h" 34 #include "chrome/browser/extensions/extension_service.h"
35 #include "chrome/browser/extensions/extension_test_message_listener.h" 35 #include "chrome/browser/extensions/extension_test_message_listener.h"
36 #include "chrome/browser/profiles/profile_impl.h" 36 #include "chrome/browser/profiles/profile_impl.h"
37 #include "chrome/browser/profiles/profiles_state.h" 37 #include "chrome/browser/profiles/profiles_state.h"
38 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" 38 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h"
39 #include "chrome/common/chrome_constants.h" 39 #include "chrome/common/chrome_constants.h"
40 #include "chrome/common/chrome_paths.h" 40 #include "chrome/common/chrome_paths.h"
41 #include "chrome/common/chrome_switches.h"
42 #include "chrome/common/pref_names.h" 41 #include "chrome/common/pref_names.h"
43 #include "chromeos/chromeos_switches.h" 42 #include "chromeos/chromeos_switches.h"
44 #include "chromeos/dbus/cryptohome_client.h" 43 #include "chromeos/dbus/cryptohome_client.h"
45 #include "components/signin/core/common/signin_pref_names.h" 44 #include "components/signin/core/common/signin_pref_names.h"
46 #include "content/public/browser/notification_observer.h" 45 #include "content/public/browser/notification_observer.h"
47 #include "content/public/browser/notification_registrar.h" 46 #include "content/public/browser/notification_registrar.h"
48 #include "content/public/browser/notification_service.h" 47 #include "content/public/browser/notification_service.h"
49 #include "content/public/test/browser_test_utils.h" 48 #include "content/public/test/browser_test_utils.h"
50 #include "extensions/browser/extension_system.h" 49 #include "extensions/browser/extension_system.h"
51 #include "google_apis/gaia/gaia_constants.h" 50 #include "google_apis/gaia/gaia_constants.h"
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 // Show kiosk enable screen again. 862 // Show kiosk enable screen again.
864 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", 863 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator",
865 base::StringValue("kiosk_enable")); 864 base::StringValue("kiosk_enable"));
866 865
867 // And it should show up. 866 // And it should show up.
868 content::WindowedNotificationObserver( 867 content::WindowedNotificationObserver(
869 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, 868 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE,
870 content::NotificationService::AllSources()).Wait(); 869 content::NotificationService::AllSources()).Wait();
871 } 870 }
872 871
873 class KioskUpdateTest : public KioskTest, 872 class KioskUpdateTest : public KioskTest {
874 public testing::WithParamInterface<bool> {
875 public: 873 public:
876 KioskUpdateTest() {} 874 KioskUpdateTest() {}
877 virtual ~KioskUpdateTest() {} 875 virtual ~KioskUpdateTest() {}
878 876
879 protected: 877 protected:
880 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 878 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
881 // Needs background networking so that ExtensionDownloader works. 879 // Needs background networking so that ExtensionDownloader works.
882 needs_background_networking_ = true; 880 needs_background_networking_ = true;
883
884 KioskTest::SetUpCommandLine(command_line); 881 KioskTest::SetUpCommandLine(command_line);
885 if (GetParam())
886 command_line->AppendSwitch(::switches::kMultiProfiles);
887 } 882 }
888 883
889 virtual void SetUpOnMainThread() OVERRIDE { 884 virtual void SetUpOnMainThread() OVERRIDE {
890 KioskTest::SetUpOnMainThread(); 885 KioskTest::SetUpOnMainThread();
891 } 886 }
892 887
893 private: 888 private:
894 889
895 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); 890 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest);
896 }; 891 };
897 892
898 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { 893 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) {
899 set_test_app_id(kTestOfflineEnabledKioskApp); 894 set_test_app_id(kTestOfflineEnabledKioskApp);
900 895
901 PrepareAppLaunch(); 896 PrepareAppLaunch();
902 SimulateNetworkOffline(); 897 SimulateNetworkOffline();
903 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); 898 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile");
904 899
905 LaunchApp(test_app_id(), false); 900 LaunchApp(test_app_id(), false);
906 WaitForAppLaunchSuccess(); 901 WaitForAppLaunchSuccess();
907 } 902 }
908 903
909 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { 904 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) {
910 set_test_app_id(kTestOfflineEnabledKioskApp); 905 set_test_app_id(kTestOfflineEnabledKioskApp);
911 906
912 fake_cws()->SetNoUpdate(test_app_id()); 907 fake_cws()->SetNoUpdate(test_app_id());
913 908
914 PrepareAppLaunch(); 909 PrepareAppLaunch();
915 SimulateNetworkOnline(); 910 SimulateNetworkOnline();
916 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); 911 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile");
917 912
918 LaunchApp(test_app_id(), false); 913 LaunchApp(test_app_id(), false);
919 WaitForAppLaunchSuccess(); 914 WaitForAppLaunchSuccess();
920 915
921 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); 916 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString());
922 } 917 }
923 918
924 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { 919 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) {
925 set_test_app_id(kTestOfflineEnabledKioskApp); 920 set_test_app_id(kTestOfflineEnabledKioskApp);
926 921
927 fake_cws()->SetUpdateCrx( 922 fake_cws()->SetUpdateCrx(
928 test_app_id(), "ajoggoflpgplnnjkjamcmbepjdjdnpdp.crx", "2.0.0"); 923 test_app_id(), "ajoggoflpgplnnjkjamcmbepjdjdnpdp.crx", "2.0.0");
929 924
930 PrepareAppLaunch(); 925 PrepareAppLaunch();
931 SimulateNetworkOnline(); 926 SimulateNetworkOnline();
932 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); 927 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile");
933 928
934 LaunchApp(test_app_id(), false); 929 LaunchApp(test_app_id(), false);
935 WaitForAppLaunchSuccess(); 930 WaitForAppLaunchSuccess();
936 931
937 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); 932 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString());
938 } 933 }
939 934
940 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PermissionChange) { 935 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PermissionChange) {
941 set_test_app_id(kTestOfflineEnabledKioskApp); 936 set_test_app_id(kTestOfflineEnabledKioskApp);
942 937
943 fake_cws()->SetUpdateCrx( 938 fake_cws()->SetUpdateCrx(
944 test_app_id(), 939 test_app_id(),
945 "ajoggoflpgplnnjkjamcmbepjdjdnpdp_v2_permission_change.crx", 940 "ajoggoflpgplnnjkjamcmbepjdjdnpdp_v2_permission_change.crx",
946 "2.0.0"); 941 "2.0.0");
947 942
948 PrepareAppLaunch(); 943 PrepareAppLaunch();
949 SimulateNetworkOnline(); 944 SimulateNetworkOnline();
950 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); 945 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile");
951 946
952 LaunchApp(test_app_id(), false); 947 LaunchApp(test_app_id(), false);
953 WaitForAppLaunchSuccess(); 948 WaitForAppLaunchSuccess();
954 949
955 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); 950 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString());
956 } 951 }
957 952
958 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_PreserveLocalData) { 953 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PreserveLocalData) {
959 // Installs v1 app and writes some local data. 954 // Installs v1 app and writes some local data.
960 set_test_app_id(kTestLocalFsKioskApp); 955 set_test_app_id(kTestLocalFsKioskApp);
961 956
962 ResultCatcher catcher; 957 ResultCatcher catcher;
963 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); 958 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure());
964 WaitForAppLaunchSuccess(); 959 WaitForAppLaunchSuccess();
965 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 960 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
966 } 961 }
967 962
968 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PreserveLocalData) { 963 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PreserveLocalData) {
969 // Update existing v1 app installed in PRE_PreserveLocalData to v2 964 // Update existing v1 app installed in PRE_PreserveLocalData to v2
970 // that reads and verifies the local data. 965 // that reads and verifies the local data.
971 set_test_app_id(kTestLocalFsKioskApp); 966 set_test_app_id(kTestLocalFsKioskApp);
972 967
973 fake_cws()->SetUpdateCrx( 968 fake_cws()->SetUpdateCrx(
974 test_app_id(), 969 test_app_id(),
975 "bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx", 970 "bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx",
976 "2.0.0"); 971 "2.0.0");
977 972
978 ResultCatcher catcher; 973 ResultCatcher catcher;
979 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); 974 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure());
980 WaitForAppLaunchSuccess(); 975 WaitForAppLaunchSuccess();
981 976
982 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); 977 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString());
983 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 978 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
984 } 979 }
985 980
986 // TODO(xiyuan): Remove this after multi profile is turned on by default.
987 INSTANTIATE_TEST_CASE_P(KioskUpdateTestInstantiation,
988 KioskUpdateTest,
989 testing::Bool());
990
991 class KioskEnterpriseTest : public KioskTest { 981 class KioskEnterpriseTest : public KioskTest {
992 protected: 982 protected:
993 KioskEnterpriseTest() {} 983 KioskEnterpriseTest() {}
994 984
995 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 985 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
996 device_policy_test_helper_.MarkAsEnterpriseOwned(); 986 device_policy_test_helper_.MarkAsEnterpriseOwned();
997 device_policy_test_helper_.InstallOwnerKey(); 987 device_policy_test_helper_.InstallOwnerKey();
998 988
999 KioskTest::SetUpInProcessBrowserTestFixture(); 989 KioskTest::SetUpInProcessBrowserTestFixture();
1000 } 990 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 content::WindowedNotificationObserver( 1186 content::WindowedNotificationObserver(
1197 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, 1187 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
1198 content::NotificationService::AllSources()).Wait(); 1188 content::NotificationService::AllSources()).Wait();
1199 1189
1200 // Wait for the wallpaper to load. 1190 // Wait for the wallpaper to load.
1201 WaitForWallpaper(); 1191 WaitForWallpaper();
1202 EXPECT_TRUE(wallpaper_loaded()); 1192 EXPECT_TRUE(wallpaper_loaded());
1203 } 1193 }
1204 1194
1205 } // namespace chromeos 1195 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698