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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "chrome/browser/content_settings/cookie_settings.h" | 7 #include "chrome/browser/content_settings/cookie_settings.h" |
8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/prefs/pref_service_syncable.h" | 10 #include "chrome/browser/prefs/pref_service_syncable.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 fub_thread_(content::BrowserThread::FILE_USER_BLOCKING, &message_loop_), | 304 fub_thread_(content::BrowserThread::FILE_USER_BLOCKING, &message_loop_), |
305 io_thread_(content::BrowserThread::IO, &message_loop_) { | 305 io_thread_(content::BrowserThread::IO, &message_loop_) { |
306 } | 306 } |
307 | 307 |
308 OneClickSigninHelperIOTest::~OneClickSigninHelperIOTest() { | 308 OneClickSigninHelperIOTest::~OneClickSigninHelperIOTest() { |
309 } | 309 } |
310 | 310 |
311 void OneClickSigninHelperIOTest::SetUp() { | 311 void OneClickSigninHelperIOTest::SetUp() { |
312 OneClickSigninHelperTest::SetUp(); | 312 OneClickSigninHelperTest::SetUp(); |
313 ASSERT_TRUE(testing_profile_manager_.SetUp()); | 313 ASSERT_TRUE(testing_profile_manager_.SetUp()); |
314 OneClickSigninHelper::AssociateWithRequestForTesting(&request_, | |
315 "user@gmail.com"); | |
316 } | 314 } |
317 | 315 |
318 TestProfileIOData* OneClickSigninHelperIOTest::CreateTestProfileIOData( | 316 TestProfileIOData* OneClickSigninHelperIOTest::CreateTestProfileIOData( |
319 bool is_incognito) { | 317 bool is_incognito) { |
320 PrefService* pref_service = profile_->GetPrefs(); | 318 PrefService* pref_service = profile_->GetPrefs(); |
321 PrefService* local_state = g_browser_process->local_state(); | 319 PrefService* local_state = g_browser_process->local_state(); |
322 CookieSettings* cookie_settings = | 320 CookieSettings* cookie_settings = |
323 CookieSettings::Factory::GetForProfile(profile_); | 321 CookieSettings::Factory::GetForProfile(profile_); |
324 TestProfileIOData* io_data = new TestProfileIOData( | 322 TestProfileIOData* io_data = new TestProfileIOData( |
325 is_incognito, pref_service, local_state, cookie_settings); | 323 is_incognito, pref_service, local_state, cookie_settings); |
| 324 io_data->set_reverse_autologin_pending_email("user@gmail.com"); |
326 return io_data; | 325 return io_data; |
327 } | 326 } |
328 | 327 |
329 TEST_F(OneClickSigninHelperTest, CanOfferNoContents) { | 328 TEST_F(OneClickSigninHelperTest, CanOfferNoContents) { |
330 int error_message_id = 0; | 329 int error_message_id = 0; |
331 EXPECT_FALSE(OneClickSigninHelper::CanOffer( | 330 EXPECT_FALSE(OneClickSigninHelper::CanOffer( |
332 NULL, OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, | 331 NULL, OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, |
333 "user@gmail.com", &error_message_id)); | 332 "user@gmail.com", &error_message_id)); |
334 EXPECT_EQ(0, error_message_id); | 333 EXPECT_EQ(0, error_message_id); |
335 EXPECT_FALSE(OneClickSigninHelper::CanOffer( | 334 EXPECT_FALSE(OneClickSigninHelper::CanOffer( |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 OneClickSigninHelper::CanOfferOnIOThreadImpl( | 689 OneClickSigninHelper::CanOfferOnIOThreadImpl( |
691 valid_gaia_url_, "", &request_, io_data.get())); | 690 valid_gaia_url_, "", &request_, io_data.get())); |
692 | 691 |
693 // Simulate a policy disabling sync by writing kSyncManaged directly. | 692 // Simulate a policy disabling sync by writing kSyncManaged directly. |
694 profile_->GetTestingPrefService()->SetManagedPref( | 693 profile_->GetTestingPrefService()->SetManagedPref( |
695 prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); | 694 prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); |
696 EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, | 695 EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, |
697 OneClickSigninHelper::CanOfferOnIOThreadImpl( | 696 OneClickSigninHelper::CanOfferOnIOThreadImpl( |
698 valid_gaia_url_, "", &request_, io_data.get())); | 697 valid_gaia_url_, "", &request_, io_data.get())); |
699 } | 698 } |
OLD | NEW |