| 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/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 explicit FakeAndroidProfileOAuth2TokenService(Profile* profile) { | 98 explicit FakeAndroidProfileOAuth2TokenService(Profile* profile) { |
| 99 Initialize(profile); | 99 Initialize(profile); |
| 100 } | 100 } |
| 101 | 101 |
| 102 static BrowserContextKeyedService* Build(content::BrowserContext* profile) { | 102 static BrowserContextKeyedService* Build(content::BrowserContext* profile) { |
| 103 return new FakeAndroidProfileOAuth2TokenService( | 103 return new FakeAndroidProfileOAuth2TokenService( |
| 104 static_cast<Profile*>(profile)); | 104 static_cast<Profile*>(profile)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // AndroidProfileOAuth2TokenService overrides: | 107 // AndroidProfileOAuth2TokenService overrides: |
| 108 virtual void FetchOAuth2TokenWithUsername( | 108 virtual void FetchOAuth2Token( |
| 109 RequestImpl* request, | 109 RequestImpl* request, |
| 110 const std::string& username, | 110 const std::string& account_id, |
| 111 net::URLRequestContextGetter* getter, |
| 112 const std::string& client_id, |
| 113 const std::string& client_secret, |
| 111 const OAuth2TokenService::ScopeSet& scope) OVERRIDE { | 114 const OAuth2TokenService::ScopeSet& scope) OVERRIDE { |
| 112 ASSERT_TRUE(!HasPendingRequest()); | 115 ASSERT_TRUE(!HasPendingRequest()); |
| 113 ASSERT_EQ(kTestUser, username); | 116 ASSERT_EQ(kTestUser, account_id); |
| 114 ASSERT_EQ(2U, scope.size()); | 117 ASSERT_EQ(2U, scope.size()); |
| 115 EXPECT_EQ(1U, scope.count(GaiaConstants::kDeviceManagementServiceOAuth)); | 118 EXPECT_EQ(1U, scope.count(GaiaConstants::kDeviceManagementServiceOAuth)); |
| 116 EXPECT_EQ(1U, scope.count( | 119 EXPECT_EQ(1U, scope.count( |
| 117 "https://www.googleapis.com/auth/userinfo.email")); | 120 "https://www.googleapis.com/auth/userinfo.email")); |
| 118 pending_request_ = request->AsWeakPtr(); | 121 pending_request_ = request->AsWeakPtr(); |
| 119 } | 122 } |
| 120 | 123 |
| 121 void IssueToken(const std::string& token) { | 124 void IssueToken(const std::string& token) { |
| 122 ASSERT_TRUE(HasPendingRequest()); | 125 ASSERT_TRUE(HasPendingRequest()); |
| 123 GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone(); | 126 GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone(); |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 base::RunLoop().RunUntilIdle(); | 842 base::RunLoop().RunUntilIdle(); |
| 840 EXPECT_FALSE(manager_->IsClientRegistered()); | 843 EXPECT_FALSE(manager_->IsClientRegistered()); |
| 841 #if !defined(OS_ANDROID) | 844 #if !defined(OS_ANDROID) |
| 842 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); | 845 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); |
| 843 #endif | 846 #endif |
| 844 } | 847 } |
| 845 | 848 |
| 846 } // namespace | 849 } // namespace |
| 847 | 850 |
| 848 } // namespace policy | 851 } // namespace policy |
| OLD | NEW |