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" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ProfileInvalidationProviderFactory::GetInstance()-> | 45 ProfileInvalidationProviderFactory::GetInstance()-> |
46 GetServiceForBrowserContext(profile, false)); | 46 GetServiceForBrowserContext(profile, false)); |
47 } | 47 } |
48 | 48 |
49 class ProfileInvalidationProviderFactoryLoginScreenBrowserTest | 49 class ProfileInvalidationProviderFactoryLoginScreenBrowserTest |
50 : public ProfileInvalidationProviderFactoryTestBase { | 50 : public ProfileInvalidationProviderFactoryTestBase { |
51 protected: | 51 protected: |
52 ProfileInvalidationProviderFactoryLoginScreenBrowserTest(); | 52 ProfileInvalidationProviderFactoryLoginScreenBrowserTest(); |
53 virtual ~ProfileInvalidationProviderFactoryLoginScreenBrowserTest(); | 53 virtual ~ProfileInvalidationProviderFactoryLoginScreenBrowserTest(); |
54 | 54 |
55 virtual void SetUpCommandLine(CommandLine* command_line) override; | 55 virtual void SetUpCommandLine(base::CommandLine* command_line) override; |
56 | 56 |
57 private: | 57 private: |
58 DISALLOW_COPY_AND_ASSIGN( | 58 DISALLOW_COPY_AND_ASSIGN( |
59 ProfileInvalidationProviderFactoryLoginScreenBrowserTest); | 59 ProfileInvalidationProviderFactoryLoginScreenBrowserTest); |
60 }; | 60 }; |
61 | 61 |
62 ProfileInvalidationProviderFactoryLoginScreenBrowserTest:: | 62 ProfileInvalidationProviderFactoryLoginScreenBrowserTest:: |
63 ProfileInvalidationProviderFactoryLoginScreenBrowserTest() { | 63 ProfileInvalidationProviderFactoryLoginScreenBrowserTest() { |
64 } | 64 } |
65 | 65 |
66 ProfileInvalidationProviderFactoryLoginScreenBrowserTest:: | 66 ProfileInvalidationProviderFactoryLoginScreenBrowserTest:: |
67 ~ProfileInvalidationProviderFactoryLoginScreenBrowserTest() { | 67 ~ProfileInvalidationProviderFactoryLoginScreenBrowserTest() { |
68 } | 68 } |
69 | 69 |
70 void ProfileInvalidationProviderFactoryLoginScreenBrowserTest::SetUpCommandLine( | 70 void ProfileInvalidationProviderFactoryLoginScreenBrowserTest::SetUpCommandLine( |
71 CommandLine* command_line) { | 71 base::CommandLine* command_line) { |
72 command_line->AppendSwitch(chromeos::switches::kLoginManager); | 72 command_line->AppendSwitch(chromeos::switches::kLoginManager); |
73 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); | 73 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); |
74 } | 74 } |
75 | 75 |
76 // Verify that no InvalidationService is instantiated for the login profile on | 76 // Verify that no InvalidationService is instantiated for the login profile on |
77 // the login screen. | 77 // the login screen. |
78 IN_PROC_BROWSER_TEST_F(ProfileInvalidationProviderFactoryLoginScreenBrowserTest, | 78 IN_PROC_BROWSER_TEST_F(ProfileInvalidationProviderFactoryLoginScreenBrowserTest, |
79 NoInvalidationService) { | 79 NoInvalidationService) { |
80 Profile* login_profile = | 80 Profile* login_profile = |
81 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile(); | 81 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile(); |
82 EXPECT_FALSE(CanConstructProfileInvalidationProvider(login_profile)); | 82 EXPECT_FALSE(CanConstructProfileInvalidationProvider(login_profile)); |
83 } | 83 } |
84 | 84 |
85 class ProfileInvalidationProviderFactoryGuestBrowserTest | 85 class ProfileInvalidationProviderFactoryGuestBrowserTest |
86 : public ProfileInvalidationProviderFactoryTestBase { | 86 : public ProfileInvalidationProviderFactoryTestBase { |
87 protected: | 87 protected: |
88 ProfileInvalidationProviderFactoryGuestBrowserTest(); | 88 ProfileInvalidationProviderFactoryGuestBrowserTest(); |
89 virtual ~ProfileInvalidationProviderFactoryGuestBrowserTest(); | 89 virtual ~ProfileInvalidationProviderFactoryGuestBrowserTest(); |
90 | 90 |
91 virtual void SetUpCommandLine(CommandLine* command_line) override; | 91 virtual void SetUpCommandLine(base::CommandLine* command_line) override; |
92 | 92 |
93 private: | 93 private: |
94 DISALLOW_COPY_AND_ASSIGN(ProfileInvalidationProviderFactoryGuestBrowserTest); | 94 DISALLOW_COPY_AND_ASSIGN(ProfileInvalidationProviderFactoryGuestBrowserTest); |
95 }; | 95 }; |
96 | 96 |
97 ProfileInvalidationProviderFactoryGuestBrowserTest:: | 97 ProfileInvalidationProviderFactoryGuestBrowserTest:: |
98 ProfileInvalidationProviderFactoryGuestBrowserTest() { | 98 ProfileInvalidationProviderFactoryGuestBrowserTest() { |
99 } | 99 } |
100 | 100 |
101 ProfileInvalidationProviderFactoryGuestBrowserTest:: | 101 ProfileInvalidationProviderFactoryGuestBrowserTest:: |
102 ~ProfileInvalidationProviderFactoryGuestBrowserTest() { | 102 ~ProfileInvalidationProviderFactoryGuestBrowserTest() { |
103 } | 103 } |
104 | 104 |
105 void ProfileInvalidationProviderFactoryGuestBrowserTest::SetUpCommandLine( | 105 void ProfileInvalidationProviderFactoryGuestBrowserTest::SetUpCommandLine( |
106 CommandLine* command_line) { | 106 base::CommandLine* command_line) { |
107 command_line->AppendSwitch(chromeos::switches::kGuestSession); | 107 command_line->AppendSwitch(chromeos::switches::kGuestSession); |
108 command_line->AppendSwitch(::switches::kIncognito); | 108 command_line->AppendSwitch(::switches::kIncognito); |
109 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); | 109 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); |
110 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, | 110 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
111 chromeos::login::kGuestUserName); | 111 chromeos::login::kGuestUserName); |
112 } | 112 } |
113 | 113 |
114 // Verify that no InvalidationService is instantiated for the login profile or | 114 // Verify that no InvalidationService is instantiated for the login profile or |
115 // the guest profile while a guest session is in progress. | 115 // the guest profile while a guest session is in progress. |
116 IN_PROC_BROWSER_TEST_F(ProfileInvalidationProviderFactoryGuestBrowserTest, | 116 IN_PROC_BROWSER_TEST_F(ProfileInvalidationProviderFactoryGuestBrowserTest, |
117 NoInvalidationService) { | 117 NoInvalidationService) { |
118 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 118 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
119 EXPECT_TRUE(user_manager->IsLoggedInAsGuest()); | 119 EXPECT_TRUE(user_manager->IsLoggedInAsGuest()); |
120 Profile* guest_profile = | 120 Profile* guest_profile = |
121 chromeos::ProfileHelper::Get() | 121 chromeos::ProfileHelper::Get() |
122 ->GetProfileByUserUnsafe(user_manager->GetActiveUser()) | 122 ->GetProfileByUserUnsafe(user_manager->GetActiveUser()) |
123 ->GetOriginalProfile(); | 123 ->GetOriginalProfile(); |
124 Profile* login_profile = | 124 Profile* login_profile = |
125 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile(); | 125 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile(); |
126 EXPECT_FALSE(CanConstructProfileInvalidationProvider(guest_profile)); | 126 EXPECT_FALSE(CanConstructProfileInvalidationProvider(guest_profile)); |
127 EXPECT_FALSE(CanConstructProfileInvalidationProvider(login_profile)); | 127 EXPECT_FALSE(CanConstructProfileInvalidationProvider(login_profile)); |
128 } | 128 } |
129 | 129 |
130 } // namespace invalidation | 130 } // namespace invalidation |
OLD | NEW |