| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void CreateSyncStarter(OneClickSigninSyncStarter::Callback callback) { | 58 void CreateSyncStarter(OneClickSigninSyncStarter::Callback callback) { |
| 59 sync_starter_ = new OneClickSigninSyncStarter( | 59 sync_starter_ = new OneClickSigninSyncStarter( |
| 60 profile_.get(), | 60 profile_.get(), |
| 61 NULL, | 61 NULL, |
| 62 kTestingUsername, | 62 kTestingUsername, |
| 63 std::string(), | 63 std::string(), |
| 64 "refresh_token", | 64 "refresh_token", |
| 65 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, | 65 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, |
| 66 NULL, | 66 NULL, |
| 67 OneClickSigninSyncStarter::NO_CONFIRMATION, | 67 OneClickSigninSyncStarter::NO_CONFIRMATION, |
| 68 GURL(), |
| 68 callback); | 69 callback); |
| 69 } | 70 } |
| 70 | 71 |
| 71 content::TestBrowserThreadBundle thread_bundle_; | 72 content::TestBrowserThreadBundle thread_bundle_; |
| 72 | 73 |
| 73 scoped_ptr<TestingProfile> profile_; | 74 scoped_ptr<TestingProfile> profile_; |
| 74 | 75 |
| 75 // Deletes itself when SigninFailed() or SigninSuccess() is called. | 76 // Deletes itself when SigninFailed() or SigninSuccess() is called. |
| 76 OneClickSigninSyncStarter* sync_starter_; | 77 OneClickSigninSyncStarter* sync_starter_; |
| 77 | 78 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 100 } | 101 } |
| 101 | 102 |
| 102 // Verifies that there is no crash when the callback is NULL. | 103 // Verifies that there is no crash when the callback is NULL. |
| 103 TEST_F(OneClickSigninSyncStarterTest, CallbackNull) { | 104 TEST_F(OneClickSigninSyncStarterTest, CallbackNull) { |
| 104 CreateSyncStarter(OneClickSigninSyncStarter::Callback()); | 105 CreateSyncStarter(OneClickSigninSyncStarter::Callback()); |
| 105 sync_starter_->SigninFailed(GoogleServiceAuthError( | 106 sync_starter_->SigninFailed(GoogleServiceAuthError( |
| 106 GoogleServiceAuthError::REQUEST_CANCELED)); | 107 GoogleServiceAuthError::REQUEST_CANCELED)); |
| 107 EXPECT_EQ(0, failed_count_); | 108 EXPECT_EQ(0, failed_count_); |
| 108 EXPECT_EQ(0, succeeded_count_); | 109 EXPECT_EQ(0, succeeded_count_); |
| 109 } | 110 } |
| OLD | NEW |