| 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/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" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 bool first_setup_in_progress_; | 211 bool first_setup_in_progress_; |
| 212 bool sync_active_; | 212 bool sync_active_; |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 } // namespace | 215 } // namespace |
| 216 | 216 |
| 217 class OneClickSigninHelperTest : public ChromeRenderViewHostTestHarness { | 217 class OneClickSigninHelperTest : public ChromeRenderViewHostTestHarness { |
| 218 public: | 218 public: |
| 219 OneClickSigninHelperTest(); | 219 OneClickSigninHelperTest(); |
| 220 | 220 |
| 221 virtual void SetUp() override; | 221 void SetUp() override; |
| 222 virtual void TearDown() override; | 222 void TearDown() override; |
| 223 | 223 |
| 224 // Sets up the sign-in manager for tests. If |username| is | 224 // Sets up the sign-in manager for tests. If |username| is |
| 225 // is not empty, the profile of the mock WebContents will be connected to | 225 // is not empty, the profile of the mock WebContents will be connected to |
| 226 // the given account. | 226 // the given account. |
| 227 void SetUpSigninManager(const std::string& username); | 227 void SetUpSigninManager(const std::string& username); |
| 228 | 228 |
| 229 // Set the ID of the signin process that the test will assume to be the | 229 // Set the ID of the signin process that the test will assume to be the |
| 230 // only process allowed to sign the user in to Chrome. | 230 // only process allowed to sign the user in to Chrome. |
| 231 void SetTrustedSigninProcessID(int id); | 231 void SetTrustedSigninProcessID(int id); |
| 232 | 232 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 static_cast<FakeProfileOAuth2TokenService*>( | 337 static_cast<FakeProfileOAuth2TokenService*>( |
| 338 ProfileOAuth2TokenServiceFactory::GetForProfile(profile.get())); | 338 ProfileOAuth2TokenServiceFactory::GetForProfile(profile.get())); |
| 339 | 339 |
| 340 return profile.release(); | 340 return profile.release(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 class OneClickSigninHelperIOTest : public OneClickSigninHelperTest { | 343 class OneClickSigninHelperIOTest : public OneClickSigninHelperTest { |
| 344 public: | 344 public: |
| 345 OneClickSigninHelperIOTest(); | 345 OneClickSigninHelperIOTest(); |
| 346 | 346 |
| 347 virtual void SetUp() override; | 347 void SetUp() override; |
| 348 | 348 |
| 349 TestProfileIOData* CreateTestProfileIOData(Profile::ProfileType profile_type); | 349 TestProfileIOData* CreateTestProfileIOData(Profile::ProfileType profile_type); |
| 350 | 350 |
| 351 protected: | 351 protected: |
| 352 TestingProfileManager testing_profile_manager_; | 352 TestingProfileManager testing_profile_manager_; |
| 353 TestURLRequest request_; | 353 TestURLRequest request_; |
| 354 const GURL valid_gaia_url_; | 354 const GURL valid_gaia_url_; |
| 355 | 355 |
| 356 private: | 356 private: |
| 357 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelperIOTest); | 357 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelperIOTest); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 | 851 |
| 852 MockStarterWrapper::MockStarterWrapper( | 852 MockStarterWrapper::MockStarterWrapper( |
| 853 const OneClickSigninHelper::StartSyncArgs& args, | 853 const OneClickSigninHelper::StartSyncArgs& args, |
| 854 OneClickSigninSyncStarter::StartSyncMode start_mode) | 854 OneClickSigninSyncStarter::StartSyncMode start_mode) |
| 855 : testing::StrictMock<OneClickSigninHelper::SyncStarterWrapper>( | 855 : testing::StrictMock<OneClickSigninHelper::SyncStarterWrapper>( |
| 856 args, start_mode) { | 856 args, start_mode) { |
| 857 } | 857 } |
| 858 | 858 |
| 859 class OneClickSyncStarterWrapperTest : public testing::Test { | 859 class OneClickSyncStarterWrapperTest : public testing::Test { |
| 860 public: | 860 public: |
| 861 virtual void SetUp() override { | 861 void SetUp() override { |
| 862 TestingProfile::Builder builder; | 862 TestingProfile::Builder builder; |
| 863 profile_ = builder.Build(); | 863 profile_ = builder.Build(); |
| 864 } | 864 } |
| 865 | 865 |
| 866 virtual void TearDown() override { | 866 void TearDown() override { |
| 867 // Let the SyncStarterWrapper delete itself. | 867 // Let the SyncStarterWrapper delete itself. |
| 868 base::RunLoop().RunUntilIdle(); | 868 base::RunLoop().RunUntilIdle(); |
| 869 } | 869 } |
| 870 | 870 |
| 871 void SetCookie(const std::string& value) { | 871 void SetCookie(const std::string& value) { |
| 872 // Set a valid LSID cookie in the test cookie store. | 872 // Set a valid LSID cookie in the test cookie store. |
| 873 scoped_refptr<net::CookieMonster> cookie_monster = | 873 scoped_refptr<net::CookieMonster> cookie_monster = |
| 874 profile()->GetCookieMonster(); | 874 profile()->GetCookieMonster(); |
| 875 net::CookieOptions options; | 875 net::CookieOptions options; |
| 876 options.set_include_httponly(); | 876 options.set_include_httponly(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 args.email = "foo@gmail.com"; | 975 args.email = "foo@gmail.com"; |
| 976 args.profile = profile(); | 976 args.profile = profile(); |
| 977 MockStarterWrapper* wrapper = new MockStarterWrapper( | 977 MockStarterWrapper* wrapper = new MockStarterWrapper( |
| 978 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); | 978 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); |
| 979 SetCookie("LSID=1234; domain=google.com; secure; httponly"); | 979 SetCookie("LSID=1234; domain=google.com; secure; httponly"); |
| 980 | 980 |
| 981 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); | 981 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); |
| 982 wrapper->Start(); | 982 wrapper->Start(); |
| 983 base::RunLoop().RunUntilIdle(); | 983 base::RunLoop().RunUntilIdle(); |
| 984 } | 984 } |
| OLD | NEW |