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

Side by Side Diff: chrome/browser/invalidation/profile_invalidation_provider_factory_browsertest.cc

Issue 2452983002: ChromeOS: This CL moves chromeos/login/user_names* to user_mananger. (Closed)
Patch Set: Remove unused include Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/chromeos/profiles/profile_helper.h" 8 #include "chrome/browser/chromeos/profiles/profile_helper.h"
9 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" 9 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
13 #include "chromeos/chromeos_switches.h" 13 #include "chromeos/chromeos_switches.h"
14 #include "chromeos/login/user_names.h"
15 #include "components/invalidation/impl/profile_invalidation_provider.h" 14 #include "components/invalidation/impl/profile_invalidation_provider.h"
16 #include "components/invalidation/public/invalidation_service.h" 15 #include "components/invalidation/public/invalidation_service.h"
17 #include "components/signin/core/account_id/account_id.h" 16 #include "components/signin/core/account_id/account_id.h"
18 #include "components/user_manager/user_manager.h" 17 #include "components/user_manager/user_manager.h"
18 #include "components/user_manager/user_names.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace invalidation { 21 namespace invalidation {
22 22
23 class ProfileInvalidationProviderFactoryTestBase : public InProcessBrowserTest { 23 class ProfileInvalidationProviderFactoryTestBase : public InProcessBrowserTest {
24 protected: 24 protected:
25 ProfileInvalidationProviderFactoryTestBase(); 25 ProfileInvalidationProviderFactoryTestBase();
26 ~ProfileInvalidationProviderFactoryTestBase() override; 26 ~ProfileInvalidationProviderFactoryTestBase() override;
27 27
28 bool CanConstructProfileInvalidationProvider(Profile* profile); 28 bool CanConstructProfileInvalidationProvider(Profile* profile);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 ~ProfileInvalidationProviderFactoryGuestBrowserTest() { 103 ~ProfileInvalidationProviderFactoryGuestBrowserTest() {
104 } 104 }
105 105
106 void ProfileInvalidationProviderFactoryGuestBrowserTest::SetUpCommandLine( 106 void ProfileInvalidationProviderFactoryGuestBrowserTest::SetUpCommandLine(
107 base::CommandLine* command_line) { 107 base::CommandLine* command_line) {
108 command_line->AppendSwitch(chromeos::switches::kGuestSession); 108 command_line->AppendSwitch(chromeos::switches::kGuestSession);
109 command_line->AppendSwitch(::switches::kIncognito); 109 command_line->AppendSwitch(::switches::kIncognito);
110 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); 110 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
111 command_line->AppendSwitchASCII( 111 command_line->AppendSwitchASCII(
112 chromeos::switches::kLoginUser, 112 chromeos::switches::kLoginUser,
113 chromeos::login::GuestAccountId().GetUserEmail()); 113 user_manager::GuestAccountId().GetUserEmail());
114 } 114 }
115 115
116 // Verify that no InvalidationService is instantiated for the login profile or 116 // Verify that no InvalidationService is instantiated for the login profile or
117 // the guest profile while a guest session is in progress. 117 // the guest profile while a guest session is in progress.
118 IN_PROC_BROWSER_TEST_F(ProfileInvalidationProviderFactoryGuestBrowserTest, 118 IN_PROC_BROWSER_TEST_F(ProfileInvalidationProviderFactoryGuestBrowserTest,
119 NoInvalidationService) { 119 NoInvalidationService) {
120 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 120 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
121 EXPECT_TRUE(user_manager->IsLoggedInAsGuest()); 121 EXPECT_TRUE(user_manager->IsLoggedInAsGuest());
122 Profile* guest_profile = 122 Profile* guest_profile =
123 chromeos::ProfileHelper::Get() 123 chromeos::ProfileHelper::Get()
124 ->GetProfileByUserUnsafe(user_manager->GetActiveUser()) 124 ->GetProfileByUserUnsafe(user_manager->GetActiveUser())
125 ->GetOriginalProfile(); 125 ->GetOriginalProfile();
126 Profile* login_profile = 126 Profile* login_profile =
127 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile(); 127 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile();
128 EXPECT_FALSE(CanConstructProfileInvalidationProvider(guest_profile)); 128 EXPECT_FALSE(CanConstructProfileInvalidationProvider(guest_profile));
129 EXPECT_FALSE(CanConstructProfileInvalidationProvider(login_profile)); 129 EXPECT_FALSE(CanConstructProfileInvalidationProvider(login_profile));
130 } 130 }
131 131
132 } // namespace invalidation 132 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698