OLD | NEW |
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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/content_settings/cookie_settings.h" | 8 #include "chrome/browser/content_settings/cookie_settings.h" |
9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
10 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 10 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 public: | 148 public: |
149 TestURLRequest() {} | 149 TestURLRequest() {} |
150 virtual ~TestURLRequest() {} | 150 virtual ~TestURLRequest() {} |
151 }; | 151 }; |
152 | 152 |
153 class OneClickTestProfileSyncService : public TestProfileSyncService { | 153 class OneClickTestProfileSyncService : public TestProfileSyncService { |
154 public: | 154 public: |
155 virtual ~OneClickTestProfileSyncService() {} | 155 virtual ~OneClickTestProfileSyncService() {} |
156 | 156 |
157 // Helper routine to be used in conjunction with | 157 // Helper routine to be used in conjunction with |
158 // ProfileKeyedServiceFactory::SetTestingFactory(). | 158 // BrowserContextKeyedServiceFactory::SetTestingFactory(). |
159 static ProfileKeyedService* Build(content::BrowserContext* profile) { | 159 static BrowserContextKeyedService* Build(content::BrowserContext* profile) { |
160 return new OneClickTestProfileSyncService(static_cast<Profile*>(profile)); | 160 return new OneClickTestProfileSyncService(static_cast<Profile*>(profile)); |
161 } | 161 } |
162 | 162 |
163 // Need to control this for certain tests. | 163 // Need to control this for certain tests. |
164 virtual bool FirstSetupInProgress() const OVERRIDE { | 164 virtual bool FirstSetupInProgress() const OVERRIDE { |
165 return first_setup_in_progress_; | 165 return first_setup_in_progress_; |
166 } | 166 } |
167 | 167 |
168 // Controls return value of FirstSetupInProgress. Because some bits | 168 // Controls return value of FirstSetupInProgress. Because some bits |
169 // of UI depend on that value, it's useful to control it separately | 169 // of UI depend on that value, it's useful to control it separately |
(...skipping 12 matching lines...) Expand all Loading... |
182 : TestProfileSyncService(NULL, | 182 : TestProfileSyncService(NULL, |
183 profile, | 183 profile, |
184 NULL, | 184 NULL, |
185 ProfileSyncService::MANUAL_START, | 185 ProfileSyncService::MANUAL_START, |
186 false), // synchronous_backend_init | 186 false), // synchronous_backend_init |
187 first_setup_in_progress_(false) {} | 187 first_setup_in_progress_(false) {} |
188 | 188 |
189 bool first_setup_in_progress_; | 189 bool first_setup_in_progress_; |
190 }; | 190 }; |
191 | 191 |
192 static ProfileKeyedService* BuildSigninManagerMock( | 192 static BrowserContextKeyedService* BuildSigninManagerMock( |
193 content::BrowserContext* profile) { | 193 content::BrowserContext* profile) { |
194 return new SigninManagerMock(static_cast<Profile*>(profile)); | 194 return new SigninManagerMock(static_cast<Profile*>(profile)); |
195 } | 195 } |
196 | 196 |
197 } // namespace | 197 } // namespace |
198 | 198 |
199 class OneClickSigninHelperTest : public content::RenderViewHostTestHarness { | 199 class OneClickSigninHelperTest : public content::RenderViewHostTestHarness { |
200 public: | 200 public: |
201 OneClickSigninHelperTest(); | 201 OneClickSigninHelperTest(); |
202 | 202 |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 prefs::kSigninAllowed, base::Value::CreateBooleanValue(true)); | 834 prefs::kSigninAllowed, base::Value::CreateBooleanValue(true)); |
835 | 835 |
836 // Simulate a policy disabling sync by writing kSyncManaged directly. | 836 // Simulate a policy disabling sync by writing kSyncManaged directly. |
837 // We should still offer to sign in the browser. | 837 // We should still offer to sign in the browser. |
838 profile_->GetTestingPrefService()->SetManagedPref( | 838 profile_->GetTestingPrefService()->SetManagedPref( |
839 prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); | 839 prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); |
840 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, | 840 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, |
841 OneClickSigninHelper::CanOfferOnIOThreadImpl( | 841 OneClickSigninHelper::CanOfferOnIOThreadImpl( |
842 valid_gaia_url_, std::string(), &request_, io_data.get())); | 842 valid_gaia_url_, std::string(), &request_, io_data.get())); |
843 } | 843 } |
OLD | NEW |