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

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

Issue 271533004: Turning on MultiProfile by default for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 15 matching lines...) Expand all
26 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" 26 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h"
27 #include "chrome/browser/chromeos/login/wizard_controller.h" 27 #include "chrome/browser/chromeos/login/wizard_controller.h"
28 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" 28 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
29 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 29 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
30 #include "chrome/browser/chromeos/profiles/profile_helper.h" 30 #include "chrome/browser/chromeos/profiles/profile_helper.h"
31 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" 31 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
32 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " 32 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h "
33 #include "chrome/browser/extensions/extension_service.h" 33 #include "chrome/browser/extensions/extension_service.h"
34 #include "chrome/browser/extensions/extension_test_message_listener.h" 34 #include "chrome/browser/extensions/extension_test_message_listener.h"
35 #include "chrome/browser/profiles/profile_impl.h" 35 #include "chrome/browser/profiles/profile_impl.h"
36 #include "chrome/browser/profiles/profiles_state.h"
36 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" 37 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h"
37 #include "chrome/common/chrome_constants.h" 38 #include "chrome/common/chrome_constants.h"
38 #include "chrome/common/chrome_paths.h" 39 #include "chrome/common/chrome_paths.h"
39 #include "chrome/common/chrome_switches.h" 40 #include "chrome/common/chrome_switches.h"
40 #include "chrome/common/pref_names.h" 41 #include "chrome/common/pref_names.h"
41 #include "chromeos/chromeos_switches.h" 42 #include "chromeos/chromeos_switches.h"
42 #include "chromeos/dbus/cryptohome_client.h" 43 #include "chromeos/dbus/cryptohome_client.h"
43 #include "components/signin/core/common/signin_pref_names.h" 44 #include "components/signin/core/common/signin_pref_names.h"
44 #include "content/public/browser/notification_observer.h" 45 #include "content/public/browser/notification_observer.h"
45 #include "content/public/browser/notification_registrar.h" 46 #include "content/public/browser/notification_registrar.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 static_cast<KioskAppManager::ConsumerKioskAutoLaunchStatus>(-1)); 450 static_cast<KioskAppManager::ConsumerKioskAutoLaunchStatus>(-1));
450 return status; 451 return status;
451 } 452 }
452 453
453 // Copies the app profile from |relative_app_profile_dir| from test directory 454 // Copies the app profile from |relative_app_profile_dir| from test directory
454 // to the app profile directory (assuming "user") under testing profile. This 455 // to the app profile directory (assuming "user") under testing profile. This
455 // is for that needs to have a kiosk app already installed from a previous 456 // is for that needs to have a kiosk app already installed from a previous
456 // run. Note this must be called before app profile is loaded. 457 // run. Note this must be called before app profile is loaded.
457 void SetupAppProfile(const std::string& relative_app_profile_dir) { 458 void SetupAppProfile(const std::string& relative_app_profile_dir) {
458 base::FilePath app_profile_dir; 459 base::FilePath app_profile_dir;
459 if (CommandLine::ForCurrentProcess()->HasSwitch( 460 KioskAppManager::App app_data;
460 ::switches::kMultiProfiles)) { 461 CHECK(KioskAppManager::Get()->GetApp(test_app_id(), &app_data));
461 KioskAppManager::App app_data; 462 std::string app_user_id_hash =
462 CHECK(KioskAppManager::Get()->GetApp(test_app_id(), &app_data)); 463 CryptohomeClient::GetStubSanitizedUsername(app_data.user_id);
463 std::string app_user_id_hash = 464 app_profile_dir =
464 CryptohomeClient::GetStubSanitizedUsername(app_data.user_id); 465 ProfileHelper::GetProfilePathByUserIdHash(app_user_id_hash);
465 app_profile_dir =
466 ProfileHelper::GetProfilePathByUserIdHash(app_user_id_hash);
467 } else {
468 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &app_profile_dir));
469 app_profile_dir = app_profile_dir.Append(
470 ProfileHelper::GetProfileDirByLegacyLoginProfileSwitch());
471 }
472 ASSERT_TRUE(base::CreateDirectory(app_profile_dir)); 466 ASSERT_TRUE(base::CreateDirectory(app_profile_dir));
473 467
474 base::FilePath test_data_dir; 468 base::FilePath test_data_dir;
475 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); 469 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir));
476 test_data_dir = test_data_dir.AppendASCII(relative_app_profile_dir); 470 test_data_dir = test_data_dir.AppendASCII(relative_app_profile_dir);
477 ASSERT_TRUE( 471 ASSERT_TRUE(
478 base::CopyFile(test_data_dir.Append(chrome::kPreferencesFilename), 472 base::CopyFile(test_data_dir.Append(chrome::kPreferencesFilename),
479 app_profile_dir.Append(chrome::kPreferencesFilename))); 473 app_profile_dir.Append(chrome::kPreferencesFilename)));
480 ASSERT_TRUE( 474 ASSERT_TRUE(
481 base::CopyDirectory(test_data_dir.AppendASCII("Extensions"), 475 base::CopyDirectory(test_data_dir.AppendASCII("Extensions"),
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 content::WindowedNotificationObserver( 1294 content::WindowedNotificationObserver(
1301 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, 1295 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
1302 content::NotificationService::AllSources()).Wait(); 1296 content::NotificationService::AllSources()).Wait();
1303 1297
1304 // Wait for the wallpaper to load. 1298 // Wait for the wallpaper to load.
1305 WaitForWallpaper(); 1299 WaitForWallpaper();
1306 EXPECT_TRUE(wallpaper_loaded()); 1300 EXPECT_TRUE(wallpaper_loaded());
1307 } 1301 }
1308 1302
1309 } // namespace chromeos 1303 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698