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 "components/signin/core/browser/signin_manager.h" | 5 #include "components/signin/core/browser/signin_manager.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 int num_signouts_; | 68 int num_signouts_; |
69 | 69 |
70 private: | 70 private: |
71 // SigninManagerBase::Observer: | 71 // SigninManagerBase::Observer: |
72 virtual void GoogleSigninFailed( | 72 virtual void GoogleSigninFailed( |
73 const GoogleServiceAuthError& error) OVERRIDE { | 73 const GoogleServiceAuthError& error) OVERRIDE { |
74 num_failed_signins_++; | 74 num_failed_signins_++; |
75 } | 75 } |
76 | 76 |
77 virtual void GoogleSigninSucceeded( | 77 virtual void GoogleSigninSucceeded( |
78 const std::string& username, const std::string& password) OVERRIDE { | 78 const std::string& account_id, |
| 79 const std::string& username, |
| 80 const std::string& password) OVERRIDE { |
79 num_successful_signins_++; | 81 num_successful_signins_++; |
80 } | 82 } |
81 | 83 |
82 virtual void GoogleSignedOut(const std::string& username) OVERRIDE { | 84 virtual void GoogleSignedOut(const std::string& account_id, |
| 85 const std::string& username) OVERRIDE { |
83 num_signouts_++; | 86 num_signouts_++; |
84 } | 87 } |
85 }; | 88 }; |
86 | 89 |
87 } // namespace | 90 } // namespace |
88 | 91 |
89 | 92 |
90 class SigninManagerTest : public testing::Test { | 93 class SigninManagerTest : public testing::Test { |
91 public: | 94 public: |
92 SigninManagerTest() : manager_(NULL) {} | 95 SigninManagerTest() : manager_(NULL) {} |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername)); | 344 profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername)); |
342 EXPECT_EQ("external@example.com", manager_->GetAuthenticatedUsername()); | 345 EXPECT_EQ("external@example.com", manager_->GetAuthenticatedUsername()); |
343 } | 346 } |
344 | 347 |
345 TEST_F(SigninManagerTest, SigninNotAllowed) { | 348 TEST_F(SigninManagerTest, SigninNotAllowed) { |
346 std::string user("user@google.com"); | 349 std::string user("user@google.com"); |
347 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, user); | 350 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, user); |
348 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | 351 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); |
349 SetUpSigninManagerAsService(); | 352 SetUpSigninManagerAsService(); |
350 } | 353 } |
OLD | NEW |