| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 builder.AddTestingFactory( | 68 builder.AddTestingFactory( |
| 69 SigninManagerFactory::GetInstance(), | 69 SigninManagerFactory::GetInstance(), |
| 70 &OneClickSigninSyncStarterTest::BuildSigninManager); | 70 &OneClickSigninSyncStarterTest::BuildSigninManager); |
| 71 return builder.Build().release(); | 71 return builder.Build().release(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 protected: | 74 protected: |
| 75 void CreateSyncStarter(OneClickSigninSyncStarter::Callback callback, | 75 void CreateSyncStarter(OneClickSigninSyncStarter::Callback callback, |
| 76 const GURL& continue_url) { | 76 const GURL& continue_url) { |
| 77 sync_starter_ = new OneClickSigninSyncStarter( | 77 sync_starter_ = new OneClickSigninSyncStarter( |
| 78 profile(), | 78 profile(), NULL, kTestingGaiaId, kTestingUsername, std::string(), |
| 79 NULL, | 79 "refresh_token", OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, |
| 80 kTestingGaiaId, | 80 web_contents(), OneClickSigninSyncStarter::NO_CONFIRMATION, GURL(), |
| 81 kTestingUsername, | 81 continue_url, callback); |
| 82 std::string(), | |
| 83 "refresh_token", | |
| 84 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, | |
| 85 web_contents(), | |
| 86 OneClickSigninSyncStarter::NO_CONFIRMATION, | |
| 87 continue_url, | |
| 88 callback); | |
| 89 } | 82 } |
| 90 | 83 |
| 91 // Deletes itself when SigninFailed() or SigninSuccess() is called. | 84 // Deletes itself when SigninFailed() or SigninSuccess() is called. |
| 92 OneClickSigninSyncStarter* sync_starter_; | 85 OneClickSigninSyncStarter* sync_starter_; |
| 93 | 86 |
| 94 // Number of times that the callback is called with SYNC_SETUP_FAILURE. | 87 // Number of times that the callback is called with SYNC_SETUP_FAILURE. |
| 95 int failed_count_; | 88 int failed_count_; |
| 96 | 89 |
| 97 // Number of times that the callback is called with SYNC_SETUP_SUCCESS. | 90 // Number of times that the callback is called with SYNC_SETUP_SUCCESS. |
| 98 int succeeded_count_; | 91 int succeeded_count_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 131 |
| 139 const GURL kTestURL = GURL("http://www.example.com"); | 132 const GURL kTestURL = GURL("http://www.example.com"); |
| 140 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, | 133 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, |
| 141 base::Unretained(this)), | 134 base::Unretained(this)), |
| 142 kTestURL); | 135 kTestURL); |
| 143 sync_starter_->AccountAddedToCookie( | 136 sync_starter_->AccountAddedToCookie( |
| 144 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); | 137 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); |
| 145 EXPECT_EQ(1, succeeded_count_); | 138 EXPECT_EQ(1, succeeded_count_); |
| 146 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL()); | 139 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL()); |
| 147 } | 140 } |
| OLD | NEW |