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

Side by Side Diff: chrome/browser/profiles/profile_manager_unittest.cc

Issue 378513005: [Athena] Extract Chrome OS authentication stack (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix includes in one more test Created 6 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "testing/gmock/include/gmock/gmock.h" 43 #include "testing/gmock/include/gmock/gmock.h"
44 #include "testing/gtest/include/gtest/gtest.h" 44 #include "testing/gtest/include/gtest/gtest.h"
45 #include "ui/base/l10n/l10n_util.h" 45 #include "ui/base/l10n/l10n_util.h"
46 46
47 #if defined(OS_CHROMEOS) 47 #if defined(OS_CHROMEOS)
48 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" 48 #include "chrome/browser/chromeos/login/users/mock_user_manager.h"
49 #include "chrome/browser/chromeos/login/users/user_manager.h" 49 #include "chrome/browser/chromeos/login/users/user_manager.h"
50 #include "chrome/browser/chromeos/settings/cros_settings.h" 50 #include "chrome/browser/chromeos/settings/cros_settings.h"
51 #include "chrome/browser/chromeos/settings/device_settings_service.h" 51 #include "chrome/browser/chromeos/settings/device_settings_service.h"
52 #include "chromeos/chromeos_switches.h" 52 #include "chromeos/chromeos_switches.h"
53 #include "chromeos/login/user_names.h"
53 #endif 54 #endif
54 55
55 using base::ASCIIToUTF16; 56 using base::ASCIIToUTF16;
56 using content::BrowserThread; 57 using content::BrowserThread;
57 58
58 namespace { 59 namespace {
59 60
60 // This global variable is used to check that value returned to different 61 // This global variable is used to check that value returned to different
61 // observers is the same. 62 // observers is the same.
62 Profile* g_created_profile; 63 Profile* g_created_profile;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 new UnittestGuestProfileManager(temp_dir_.path())); 392 new UnittestGuestProfileManager(temp_dir_.path()));
392 393
393 #if defined(OS_CHROMEOS) 394 #if defined(OS_CHROMEOS)
394 CommandLine* cl = CommandLine::ForCurrentProcess(); 395 CommandLine* cl = CommandLine::ForCurrentProcess();
395 // This switch is needed to skip non-test specific behavior in 396 // This switch is needed to skip non-test specific behavior in
396 // ProfileManager (accessing DBusThreadManager). 397 // ProfileManager (accessing DBusThreadManager).
397 cl->AppendSwitch(switches::kTestType); 398 cl->AppendSwitch(switches::kTestType);
398 399
399 cl->AppendSwitchASCII(chromeos::switches::kLoginProfile, 400 cl->AppendSwitchASCII(chromeos::switches::kLoginProfile,
400 std::string(chrome::kProfileDirPrefix) + 401 std::string(chrome::kProfileDirPrefix) +
401 chromeos::UserManager::kGuestUserName); 402 chromeos::login::kGuestUserName);
402 cl->AppendSwitch(chromeos::switches::kGuestSession); 403 cl->AppendSwitch(chromeos::switches::kGuestSession);
403 cl->AppendSwitch(::switches::kIncognito); 404 cl->AppendSwitch(::switches::kIncognito);
404 405
405 chromeos::UserManager::Get()->UserLoggedIn( 406 chromeos::UserManager::Get()->UserLoggedIn(chromeos::login::kGuestUserName,
406 chromeos::UserManager::kGuestUserName, 407 chromeos::login::kGuestUserName,
407 chromeos::UserManager::kGuestUserName, 408 false);
408 false);
409 #endif 409 #endif
410 } 410 }
411 }; 411 };
412 412
413 TEST_F(ProfileManagerGuestTest, GetLastUsedProfileAllowedByPolicy) { 413 TEST_F(ProfileManagerGuestTest, GetLastUsedProfileAllowedByPolicy) {
414 ProfileManager* profile_manager = g_browser_process->profile_manager(); 414 ProfileManager* profile_manager = g_browser_process->profile_manager();
415 ASSERT_TRUE(profile_manager); 415 ASSERT_TRUE(profile_manager);
416 416
417 Profile* profile = profile_manager->GetLastUsedProfileAllowedByPolicy(); 417 Profile* profile = profile_manager->GetLastUsedProfileAllowedByPolicy();
418 ASSERT_TRUE(profile); 418 ASSERT_TRUE(profile);
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 dest_path2.BaseName().MaybeAsASCII()); 1116 dest_path2.BaseName().MaybeAsASCII());
1117 profile_manager->ScheduleProfileForDeletion(dest_path2, 1117 profile_manager->ScheduleProfileForDeletion(dest_path2,
1118 ProfileManager::CreateCallback()); 1118 ProfileManager::CreateCallback());
1119 // Spin the message loop so that all the callbacks can finish running. 1119 // Spin the message loop so that all the callbacks can finish running.
1120 base::RunLoop().RunUntilIdle(); 1120 base::RunLoop().RunUntilIdle();
1121 1121
1122 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); 1122 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath());
1123 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); 1123 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed));
1124 } 1124 }
1125 #endif // !defined(OS_MACOSX) 1125 #endif // !defined(OS_MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698