| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/sync/one_click_signin_sync_starter.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 SigninManagerFactory::GetInstance(), | 72 SigninManagerFactory::GetInstance(), |
| 73 &OneClickSigninSyncStarterTest::BuildSigninManager); | 73 &OneClickSigninSyncStarterTest::BuildSigninManager); |
| 74 return builder.Build().release(); | 74 return builder.Build().release(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 protected: | 77 protected: |
| 78 void CreateSyncStarter(OneClickSigninSyncStarter::Callback callback, | 78 void CreateSyncStarter(OneClickSigninSyncStarter::Callback callback, |
| 79 const GURL& continue_url) { | 79 const GURL& continue_url) { |
| 80 sync_starter_ = new OneClickSigninSyncStarter( | 80 sync_starter_ = new OneClickSigninSyncStarter( |
| 81 profile(), NULL, kTestingGaiaId, kTestingUsername, std::string(), | 81 profile(), NULL, kTestingGaiaId, kTestingUsername, std::string(), |
| 82 "refresh_token", OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, | 82 "refresh_token", OneClickSigninSyncStarter::CURRENT_PROFILE, |
| 83 web_contents(), OneClickSigninSyncStarter::NO_CONFIRMATION, GURL(), | 83 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, web_contents(), |
| 84 continue_url, callback); | 84 OneClickSigninSyncStarter::NO_CONFIRMATION, GURL(), continue_url, |
| 85 callback); |
| 85 } | 86 } |
| 86 | 87 |
| 87 // Deletes itself when SigninFailed() or SigninSuccess() is called. | 88 // Deletes itself when SigninFailed() or SigninSuccess() is called. |
| 88 OneClickSigninSyncStarter* sync_starter_; | 89 OneClickSigninSyncStarter* sync_starter_; |
| 89 | 90 |
| 90 // Number of times that the callback is called with SYNC_SETUP_FAILURE. | 91 // Number of times that the callback is called with SYNC_SETUP_FAILURE. |
| 91 int failed_count_; | 92 int failed_count_; |
| 92 | 93 |
| 93 // Number of times that the callback is called with SYNC_SETUP_SUCCESS. | 94 // Number of times that the callback is called with SYNC_SETUP_SUCCESS. |
| 94 int succeeded_count_; | 95 int succeeded_count_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 142 |
| 142 const GURL kTestURL = GURL("http://www.example.com"); | 143 const GURL kTestURL = GURL("http://www.example.com"); |
| 143 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, | 144 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, |
| 144 base::Unretained(this)), | 145 base::Unretained(this)), |
| 145 kTestURL); | 146 kTestURL); |
| 146 sync_starter_->AccountAddedToCookie( | 147 sync_starter_->AccountAddedToCookie( |
| 147 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); | 148 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); |
| 148 EXPECT_EQ(1, succeeded_count_); | 149 EXPECT_EQ(1, succeeded_count_); |
| 149 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL()); | 150 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL()); |
| 150 } | 151 } |
| OLD | NEW |