OLD | NEW |
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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.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" | 14 #include "chromeos/login/user_names.h" |
15 #include "components/invalidation/invalidation_service.h" | 15 #include "components/invalidation/invalidation_service.h" |
16 #include "components/invalidation/profile_invalidation_provider.h" | 16 #include "components/invalidation/profile_invalidation_provider.h" |
| 17 #include "components/user_manager/user_manager.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 namespace invalidation { | 20 namespace invalidation { |
20 | 21 |
21 class ProfileInvalidationProviderFactoryTestBase : public InProcessBrowserTest { | 22 class ProfileInvalidationProviderFactoryTestBase : public InProcessBrowserTest { |
22 protected: | 23 protected: |
23 ProfileInvalidationProviderFactoryTestBase(); | 24 ProfileInvalidationProviderFactoryTestBase(); |
24 virtual ~ProfileInvalidationProviderFactoryTestBase(); | 25 virtual ~ProfileInvalidationProviderFactoryTestBase(); |
25 | 26 |
26 bool CanConstructProfileInvalidationProvider(Profile* profile); | 27 bool CanConstructProfileInvalidationProvider(Profile* profile); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 command_line->AppendSwitch(::switches::kIncognito); | 108 command_line->AppendSwitch(::switches::kIncognito); |
108 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); | 109 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); |
109 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, | 110 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
110 chromeos::login::kGuestUserName); | 111 chromeos::login::kGuestUserName); |
111 } | 112 } |
112 | 113 |
113 // Verify that no InvalidationService is instantiated for the login profile or | 114 // Verify that no InvalidationService is instantiated for the login profile or |
114 // the guest profile while a guest session is in progress. | 115 // the guest profile while a guest session is in progress. |
115 IN_PROC_BROWSER_TEST_F(ProfileInvalidationProviderFactoryGuestBrowserTest, | 116 IN_PROC_BROWSER_TEST_F(ProfileInvalidationProviderFactoryGuestBrowserTest, |
116 NoInvalidationService) { | 117 NoInvalidationService) { |
117 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 118 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
118 EXPECT_TRUE(user_manager->IsLoggedInAsGuest()); | 119 EXPECT_TRUE(user_manager->IsLoggedInAsGuest()); |
119 Profile* guest_profile = | 120 Profile* guest_profile = |
120 chromeos::ProfileHelper::Get() | 121 chromeos::ProfileHelper::Get() |
121 ->GetProfileByUserUnsafe(user_manager->GetActiveUser()) | 122 ->GetProfileByUserUnsafe(user_manager->GetActiveUser()) |
122 ->GetOriginalProfile(); | 123 ->GetOriginalProfile(); |
123 Profile* login_profile = | 124 Profile* login_profile = |
124 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile(); | 125 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile(); |
125 EXPECT_FALSE(CanConstructProfileInvalidationProvider(guest_profile)); | 126 EXPECT_FALSE(CanConstructProfileInvalidationProvider(guest_profile)); |
126 EXPECT_FALSE(CanConstructProfileInvalidationProvider(login_profile)); | 127 EXPECT_FALSE(CanConstructProfileInvalidationProvider(login_profile)); |
127 } | 128 } |
128 | 129 |
129 } // namespace invalidation | 130 } // namespace invalidation |
OLD | NEW |