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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper_unittest.cc

Issue 217883004: [Signin] Factor out a helper class to load a continue URL once Sync is configured. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: That didn't work. Oh well. Created 6 years, 8 months 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 | Annotate | Revision Log
OLDNEW
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/prefs/scoped_user_pref_update.h" 6 #include "base/prefs/scoped_user_pref_update.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/content_settings/cookie_settings.h" 11 #include "chrome/browser/content_settings/cookie_settings.h"
12 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 12 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_info_cache.h" 14 #include "chrome/browser/profiles/profile_info_cache.h"
15 #include "chrome/browser/profiles/profile_io_data.h" 15 #include "chrome/browser/profiles/profile_io_data.h"
16 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
17 #include "chrome/browser/signin/chrome_signin_client.h" 17 #include "chrome/browser/signin/chrome_signin_client.h"
18 #include "chrome/browser/signin/chrome_signin_client_factory.h" 18 #include "chrome/browser/signin/chrome_signin_client_factory.h"
19 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 19 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
20 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" 20 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
21 #include "chrome/browser/signin/fake_signin_manager.h" 21 #include "chrome/browser/signin/fake_signin_manager.h"
22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
23 #include "chrome/browser/signin/signin_manager.h" 23 #include "chrome/browser/signin/signin_manager.h"
24 #include "chrome/browser/signin/signin_manager_factory.h" 24 #include "chrome/browser/signin/signin_manager_factory.h"
25 #include "chrome/browser/signin/signin_names_io_thread.h" 25 #include "chrome/browser/signin/signin_names_io_thread.h"
26 #include "chrome/browser/signin/signin_promo.h" 26 #include "chrome/browser/signin/signin_promo.h"
27 #include "chrome/browser/sync/profile_sync_service_factory.h" 27 #include "chrome/browser/sync/profile_sync_service_factory.h"
28 #include "chrome/browser/sync/profile_sync_service_mock.h"
29 #include "chrome/browser/sync/test_profile_sync_service.h" 28 #include "chrome/browser/sync/test_profile_sync_service.h"
30 #include "chrome/browser/ui/sync/one_click_signin_helper.h" 29 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
31 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 30 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
32 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 31 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
33 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
34 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 33 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
35 #include "chrome/test/base/testing_browser_process.h" 34 #include "chrome/test/base/testing_browser_process.h"
36 #include "chrome/test/base/testing_pref_service_syncable.h" 35 #include "chrome/test/base/testing_pref_service_syncable.h"
37 #include "chrome/test/base/testing_profile.h" 36 #include "chrome/test/base/testing_profile.h"
38 #include "chrome/test/base/testing_profile_manager.h" 37 #include "chrome/test/base/testing_profile_manager.h"
39 #include "components/autofill/core/common/password_form.h" 38 #include "components/autofill/core/common/password_form.h"
40 #include "components/signin/core/browser/profile_oauth2_token_service.h" 39 #include "components/signin/core/browser/profile_oauth2_token_service.h"
41 #include "components/sync_driver/pref_names.h" 40 #include "components/sync_driver/pref_names.h"
42 #include "content/public/browser/browser_context.h" 41 #include "content/public/browser/browser_context.h"
43 #include "content/public/browser/navigation_details.h" 42 #include "content/public/browser/navigation_details.h"
44 #include "content/public/browser/web_contents.h" 43 #include "content/public/browser/web_contents.h"
45 #include "content/public/common/frame_navigate_params.h" 44 #include "content/public/common/frame_navigate_params.h"
46 #include "content/public/common/url_constants.h" 45 #include "content/public/common/url_constants.h"
47 #include "content/public/test/mock_render_process_host.h" 46 #include "content/public/test/mock_render_process_host.h"
48 #include "grit/chromium_strings.h" 47 #include "grit/chromium_strings.h"
49 #include "grit/generated_resources.h" 48 #include "grit/generated_resources.h"
49 #include "testing/gmock/include/gmock/gmock.h"
50 #include "testing/gtest/include/gtest/gtest.h" 50 #include "testing/gtest/include/gtest/gtest.h"
51 #include "ui/base/l10n/l10n_util.h" 51 #include "ui/base/l10n/l10n_util.h"
52 52
53 using ::testing::_; 53 using ::testing::_;
54 using ::testing::AtLeast; 54 using ::testing::AtLeast;
55 using ::testing::Return; 55 using ::testing::Return;
56 56
57 namespace { 57 namespace {
58 58
59 class SigninManagerMock : public FakeSigninManager { 59 class SigninManagerMock : public FakeSigninManager {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 }; 154 };
155 155
156 class TestURLRequest : public base::SupportsUserData { 156 class TestURLRequest : public base::SupportsUserData {
157 public: 157 public:
158 TestURLRequest() {} 158 TestURLRequest() {}
159 virtual ~TestURLRequest() {} 159 virtual ~TestURLRequest() {}
160 }; 160 };
161 161
162 class OneClickTestProfileSyncService : public TestProfileSyncService { 162 class OneClickTestProfileSyncService : public TestProfileSyncService {
163 public: 163 public:
164 virtual ~OneClickTestProfileSyncService() {} 164 virtual ~OneClickTestProfileSyncService() {}
165 165
166 // Helper routine to be used in conjunction with 166 // Helper routine to be used in conjunction with
167 // BrowserContextKeyedServiceFactory::SetTestingFactory(). 167 // BrowserContextKeyedServiceFactory::SetTestingFactory().
168 static KeyedService* Build(content::BrowserContext* profile) { 168 static KeyedService* Build(content::BrowserContext* profile) {
169 return new OneClickTestProfileSyncService(static_cast<Profile*>(profile)); 169 return new OneClickTestProfileSyncService(static_cast<Profile*>(profile));
170 } 170 }
171 171
172 // Need to control this for certain tests. 172 // Need to control this for certain tests.
173 virtual bool FirstSetupInProgress() const OVERRIDE { 173 virtual bool FirstSetupInProgress() const OVERRIDE {
174 return first_setup_in_progress_; 174 return first_setup_in_progress_;
175 } 175 }
176 176
177 // Controls return value of FirstSetupInProgress. Because some bits 177 virtual bool sync_initialized() const OVERRIDE { return true; }
178 // of UI depend on that value, it's useful to control it separately
179 // from the internal work and components that are triggered (such as
180 // ReconfigureDataTypeManager) to facilitate unit tests.
181 void set_first_setup_in_progress(bool in_progress) {
182 first_setup_in_progress_ = in_progress;
183 }
184 178
185 private: 179 // Controls return value of FirstSetupInProgress. Because some bits
186 explicit OneClickTestProfileSyncService(Profile* profile) 180 // of UI depend on that value, it's useful to control it separately
187 : TestProfileSyncService( 181 // from the internal work and components that are triggered (such as
188 NULL, 182 // ReconfigureDataTypeManager) to facilitate unit tests.
189 profile, 183 void set_first_setup_in_progress(bool in_progress) {
190 SigninManagerFactory::GetForProfile(profile), 184 first_setup_in_progress_ = in_progress;
191 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 185 }
192 browser_sync::MANUAL_START),
193 first_setup_in_progress_(false) {}
194 186
195 bool first_setup_in_progress_; 187 private:
188 explicit OneClickTestProfileSyncService(Profile* profile)
189 : TestProfileSyncService(
190 NULL,
191 profile,
192 SigninManagerFactory::GetForProfile(profile),
193 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
194 browser_sync::MANUAL_START),
195 first_setup_in_progress_(false) {}
196
197 bool first_setup_in_progress_;
196 }; 198 };
197 199
198 } // namespace 200 } // namespace
199 201
200 class OneClickSigninHelperTest : public ChromeRenderViewHostTestHarness { 202 class OneClickSigninHelperTest : public ChromeRenderViewHostTestHarness {
201 public: 203 public:
202 OneClickSigninHelperTest(); 204 OneClickSigninHelperTest();
203 205
204 virtual void SetUp() OVERRIDE; 206 virtual void SetUp() OVERRIDE;
205 virtual void TearDown() OVERRIDE; 207 virtual void TearDown() OVERRIDE;
206 208
207 // Sets up the sign-in manager for tests. If |username| is 209 // Sets up the sign-in manager for tests. If |username| is
208 // is not empty, the profile of the mock WebContents will be connected to 210 // is not empty, the profile of the mock WebContents will be connected to
209 // the given account. 211 // the given account.
210 void SetUpSigninManager(const std::string& username); 212 void SetUpSigninManager(const std::string& username);
211 213
212 // Set the ID of the signin process that the test will assume to be the 214 // Set the ID of the signin process that the test will assume to be the
213 // only process allowed to sign the user in to Chrome. 215 // only process allowed to sign the user in to Chrome.
214 void SetTrustedSigninProcessID(int id); 216 void SetTrustedSigninProcessID(int id);
215 217
216 void AddEmailToOneClickRejectedList(const std::string& email); 218 void AddEmailToOneClickRejectedList(const std::string& email);
217 void EnableOneClick(bool enable); 219 void EnableOneClick(bool enable);
218 void AllowSigninCookies(bool enable); 220 void AllowSigninCookies(bool enable);
219 void SetAllowedUsernamePattern(const std::string& pattern); 221 void SetAllowedUsernamePattern(const std::string& pattern);
220 ProfileSyncServiceMock* CreateProfileSyncServiceMock();
221 void SubmitGAIAPassword(OneClickSigninHelper* helper); 222 void SubmitGAIAPassword(OneClickSigninHelper* helper);
222 223
223 SigninManagerMock* signin_manager_; 224 SigninManagerMock* signin_manager_;
224 FakeProfileOAuth2TokenService* fake_oauth2_token_service_; 225 FakeProfileOAuth2TokenService* fake_oauth2_token_service_;
225 226
226 protected: 227 protected:
227 GoogleServiceAuthError no_error_; 228 GoogleServiceAuthError no_error_;
228 229
229 private: 230 private:
230 // ChromeRenderViewHostTestHarness overrides: 231 // ChromeRenderViewHostTestHarness overrides:
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 cookie_settings->SetDefaultCookieSetting(enable ? CONTENT_SETTING_ALLOW 294 cookie_settings->SetDefaultCookieSetting(enable ? CONTENT_SETTING_ALLOW
294 : CONTENT_SETTING_BLOCK); 295 : CONTENT_SETTING_BLOCK);
295 } 296 }
296 297
297 void OneClickSigninHelperTest::SetAllowedUsernamePattern( 298 void OneClickSigninHelperTest::SetAllowedUsernamePattern(
298 const std::string& pattern) { 299 const std::string& pattern) {
299 PrefService* local_state = g_browser_process->local_state(); 300 PrefService* local_state = g_browser_process->local_state();
300 local_state->SetString(prefs::kGoogleServicesUsernamePattern, pattern); 301 local_state->SetString(prefs::kGoogleServicesUsernamePattern, pattern);
301 } 302 }
302 303
303 ProfileSyncServiceMock*
304 OneClickSigninHelperTest::CreateProfileSyncServiceMock() {
305 ProfileSyncServiceMock* sync_service = static_cast<ProfileSyncServiceMock*>(
306 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
307 profile(),
308 ProfileSyncServiceMock::BuildMockProfileSyncService));
309 EXPECT_CALL(*sync_service, FirstSetupInProgress()).WillRepeatedly(
310 Return(false));
311 EXPECT_CALL(*sync_service, sync_initialized()).WillRepeatedly(Return(true));
312 EXPECT_CALL(*sync_service, GetAuthError()).
313 WillRepeatedly(::testing::ReturnRef(no_error_));
314 EXPECT_CALL(*sync_service, sync_initialized()).WillRepeatedly(Return(false));
315 ON_CALL(*sync_service, GetRegisteredDataTypes())
316 .WillByDefault(Return(syncer::ModelTypeSet()));
317 sync_service->Initialize();
318 return sync_service;
319 }
320
321 void OneClickSigninHelperTest::SubmitGAIAPassword( 304 void OneClickSigninHelperTest::SubmitGAIAPassword(
322 OneClickSigninHelper* helper) { 305 OneClickSigninHelper* helper) {
323 autofill::PasswordForm password_form; 306 autofill::PasswordForm password_form;
324 password_form.origin = GURL("https://accounts.google.com"); 307 password_form.origin = GURL("https://accounts.google.com");
325 password_form.signon_realm = "https://accounts.google.com"; 308 password_form.signon_realm = "https://accounts.google.com";
326 password_form.password_value = base::UTF8ToUTF16("password"); 309 password_form.password_value = base::UTF8ToUTF16("password");
327 helper->PasswordSubmitted(password_form); 310 helper->PasswordSubmitted(password_form);
328 } 311 }
329 312
330 content::BrowserContext* OneClickSigninHelperTest::CreateBrowserContext() { 313 content::BrowserContext* OneClickSigninHelperTest::CreateBrowserContext() {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 TEST_F(OneClickSigninHelperTest, CanOfferFirstSetup) { 438 TEST_F(OneClickSigninHelperTest, CanOfferFirstSetup) {
456 SetUpSigninManager(std::string()); 439 SetUpSigninManager(std::string());
457 440
458 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). 441 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)).
459 WillRepeatedly(Return(true)); 442 WillRepeatedly(Return(true));
460 443
461 // Invoke OneClickTestProfileSyncService factory function and grab result. 444 // Invoke OneClickTestProfileSyncService factory function and grab result.
462 OneClickTestProfileSyncService* sync = 445 OneClickTestProfileSyncService* sync =
463 static_cast<OneClickTestProfileSyncService*>( 446 static_cast<OneClickTestProfileSyncService*>(
464 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( 447 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
465 static_cast<Profile*>(browser_context()), 448 profile(), OneClickTestProfileSyncService::Build));
466 OneClickTestProfileSyncService::Build));
467 sync->Initialize(); 449 sync->Initialize();
468 sync->set_first_setup_in_progress(true); 450 sync->set_first_setup_in_progress(true);
469 451
470 EXPECT_TRUE(OneClickSigninHelper::CanOffer( 452 EXPECT_TRUE(OneClickSigninHelper::CanOffer(
471 web_contents(), 453 web_contents(),
472 OneClickSigninHelper::CAN_OFFER_FOR_ALL, 454 OneClickSigninHelper::CAN_OFFER_FOR_ALL,
473 "foo@gmail.com", NULL)); 455 "foo@gmail.com", NULL));
474 EXPECT_TRUE(OneClickSigninHelper::CanOffer( 456 EXPECT_TRUE(OneClickSigninHelper::CanOffer(
475 web_contents(), 457 web_contents(),
476 OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, 458 OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 649 }
668 650
669 // If Chrome signin is triggered from a webstore install, and user chooses to 651 // If Chrome signin is triggered from a webstore install, and user chooses to
670 // config sync, then Chrome should redirect immediately to sync settings page, 652 // config sync, then Chrome should redirect immediately to sync settings page,
671 // and upon successful setup, redirect back to webstore. 653 // and upon successful setup, redirect back to webstore.
672 TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) { 654 TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) {
673 SetUpSigninManager(std::string()); 655 SetUpSigninManager(std::string());
674 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)) 656 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_))
675 .WillRepeatedly(Return(true)); 657 .WillRepeatedly(Return(true));
676 658
677 ProfileSyncServiceMock* sync_service = CreateProfileSyncServiceMock(); 659 TestProfileSyncService* sync_service =
678 EXPECT_CALL(*sync_service, AddObserver(_)).Times(AtLeast(1)); 660 static_cast<TestProfileSyncService*>(
679 EXPECT_CALL(*sync_service, RemoveObserver(_)).Times(AtLeast(1)); 661 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
680 EXPECT_CALL(*sync_service, sync_initialized()).WillRepeatedly(Return(true)); 662 profile(), OneClickTestProfileSyncService::Build));
681 663
682 content::WebContents* contents = web_contents(); 664 content::WebContents* contents = web_contents();
683 665
684 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL); 666 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL);
685 OneClickSigninHelper* helper = 667 OneClickSigninHelper* helper =
686 OneClickSigninHelper::FromWebContents(contents); 668 OneClickSigninHelper::FromWebContents(contents);
687 helper->SetDoNotClearPendingEmailForTesting(); 669 helper->SetDoNotClearPendingEmailForTesting();
688 helper->set_do_not_start_sync_for_testing(); 670 helper->set_do_not_start_sync_for_testing();
689 671
690 GURL continueUrl("https://chrome.google.com/webstore?source=5"); 672 GURL continueUrl("https://chrome.google.com/webstore?source=5");
691 OneClickSigninHelper::ShowInfoBarUIThread( 673 OneClickSigninHelper::ShowInfoBarUIThread(
692 "session_index", "user@gmail.com", 674 "session_index", "user@gmail.com",
693 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, 675 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT,
694 signin::SOURCE_WEBSTORE_INSTALL, 676 signin::SOURCE_WEBSTORE_INSTALL,
695 continueUrl, process()->GetID(), rvh()->GetRoutingID()); 677 continueUrl, process()->GetID(), rvh()->GetRoutingID());
696 678
697 SubmitGAIAPassword(helper); 679 SubmitGAIAPassword(helper);
698 680
699 NavigateAndCommit(GURL("https://chrome.google.com/webstore?source=3")); 681 NavigateAndCommit(GURL("https://chrome.google.com/webstore?source=3"));
700 helper->DidStopLoading(rvh()); 682 helper->DidStopLoading(rvh());
701 helper->OnStateChanged(); 683 sync_service->NotifyObservers();
702 EXPECT_EQ(GURL(continueUrl), contents->GetURL()); 684 EXPECT_EQ(GURL(continueUrl), contents->GetVisibleURL());
703 } 685 }
704 686
705 // Checks that the state of OneClickSigninHelper is cleaned when there is a 687 // Checks that the state of OneClickSigninHelper is cleaned when there is a
706 // navigation away from the sign in flow that is not triggered by the 688 // navigation away from the sign in flow that is not triggered by the
707 // web contents. 689 // web contents.
708 TEST_F(OneClickSigninHelperTest, CleanTransientStateOnNavigate) { 690 TEST_F(OneClickSigninHelperTest, CleanTransientStateOnNavigate) {
709 content::WebContents* contents = web_contents(); 691 content::WebContents* contents = web_contents();
710 692
711 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL); 693 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL);
712 OneClickSigninHelper* helper = 694 OneClickSigninHelper* helper =
713 OneClickSigninHelper::FromWebContents(contents); 695 OneClickSigninHelper::FromWebContents(contents);
714 helper->SetDoNotClearPendingEmailForTesting(); 696 helper->SetDoNotClearPendingEmailForTesting();
715 helper->auto_accept_ = OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT; 697 helper->auto_accept_ = OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT;
716 698
717 content::LoadCommittedDetails details; 699 content::LoadCommittedDetails details;
718 content::FrameNavigateParams params; 700 content::FrameNavigateParams params;
719 params.url = GURL("http://crbug.com"); 701 params.url = GURL("http://crbug.com");
720 params.transition = content::PAGE_TRANSITION_TYPED; 702 params.transition = content::PAGE_TRANSITION_TYPED;
721 helper->DidNavigateMainFrame(details, params); 703 helper->DidNavigateMainFrame(details, params);
722 704
723 EXPECT_EQ(OneClickSigninHelper::AUTO_ACCEPT_NONE, helper->auto_accept_); 705 EXPECT_EQ(OneClickSigninHelper::AUTO_ACCEPT_NONE, helper->auto_accept_);
724 } 706 }
725 707
726 // Checks that OneClickSigninHelper doesn't stay an observer of the profile
727 // sync service after it's deleted.
728 TEST_F(OneClickSigninHelperTest, RemoveObserverFromProfileSyncService) {
729 content::WebContents* contents = web_contents();
730
731 ProfileSyncServiceMock* sync_service = CreateProfileSyncServiceMock();
732
733 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL);
734 OneClickSigninHelper* helper =
735 OneClickSigninHelper::FromWebContents(contents);
736 helper->SetDoNotClearPendingEmailForTesting();
737
738 // Need to expect two calls, because sync service also tears down observers.
739 // TODO(signin): gmock probably isn't the best solution here.
740 EXPECT_CALL(*sync_service, RemoveObserver(_));
741 EXPECT_CALL(*sync_service, RemoveObserver(helper));
742 SetContents(NULL);
743 }
744
745 // I/O thread tests 708 // I/O thread tests
746 709
747 TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThread) { 710 TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThread) {
748 scoped_ptr<TestProfileIOData> io_data( 711 scoped_ptr<TestProfileIOData> io_data(
749 CreateTestProfileIOData(Profile::REGULAR_PROFILE)); 712 CreateTestProfileIOData(Profile::REGULAR_PROFILE));
750 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, 713 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER,
751 OneClickSigninHelper::CanOfferOnIOThreadImpl( 714 OneClickSigninHelper::CanOfferOnIOThreadImpl(
752 valid_gaia_url_, &request_, io_data.get())); 715 valid_gaia_url_, &request_, io_data.get()));
753 } 716 }
754 717
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 args.email = "foo@gmail.com"; 974 args.email = "foo@gmail.com";
1012 args.profile = profile(); 975 args.profile = profile();
1013 MockStarterWrapper* wrapper = new MockStarterWrapper( 976 MockStarterWrapper* wrapper = new MockStarterWrapper(
1014 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); 977 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
1015 SetCookie("LSID=1234; domain=google.com; secure; httponly"); 978 SetCookie("LSID=1234; domain=google.com; secure; httponly");
1016 979
1017 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); 980 EXPECT_CALL(*wrapper, DisplayErrorBubble(_));
1018 wrapper->Start(); 981 wrapper->Start();
1019 base::RunLoop().RunUntilIdle(); 982 base::RunLoop().RunUntilIdle();
1020 } 983 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698