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 // This file defines a unit test for the profile's token service. | 5 // This file defines a unit test for the profile's token service. |
6 | 6 |
7 #include "chrome/browser/signin/token_service_unittest.h" | 7 #include "chrome/browser/signin/token_service_unittest.h" |
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 TEST_F(TokenServiceTest, OnTokenSuccessUpdate) { | 218 TEST_F(TokenServiceTest, OnTokenSuccessUpdate) { |
219 service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, "token"); | 219 service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, "token"); |
220 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); | 220 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); |
221 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), "token"); | 221 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), "token"); |
222 | 222 |
223 service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, "token2"); | 223 service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, "token2"); |
224 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); | 224 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); |
225 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), | 225 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), |
226 "token2"); | 226 "token2"); |
227 | 227 |
228 service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, ""); | 228 service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, std::string()); |
229 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); | 229 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); |
230 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), ""); | 230 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), ""); |
231 } | 231 } |
232 | 232 |
233 TEST_F(TokenServiceTest, OnOAuth2LoginTokenSuccessUpdate) { | 233 TEST_F(TokenServiceTest, OnOAuth2LoginTokenSuccessUpdate) { |
234 std::string service = GaiaConstants::kGaiaOAuth2LoginRefreshToken; | 234 std::string service = GaiaConstants::kGaiaOAuth2LoginRefreshToken; |
235 service_->OnClientOAuthSuccess( | 235 service_->OnClientOAuthSuccess( |
236 GaiaAuthConsumer::ClientOAuthResult("rt1", "at1", 3600)); | 236 GaiaAuthConsumer::ClientOAuthResult("rt1", "at1", 3600)); |
237 EXPECT_TRUE(service_->HasOAuthLoginToken()); | 237 EXPECT_TRUE(service_->HasOAuthLoginToken()); |
238 EXPECT_EQ(service_->GetOAuth2LoginRefreshToken(), "rt1"); | 238 EXPECT_EQ(service_->GetOAuth2LoginRefreshToken(), "rt1"); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 *CommandLine::ForCurrentProcess() = original_cl; | 418 *CommandLine::ForCurrentProcess() = original_cl; |
419 } | 419 } |
420 }; | 420 }; |
421 | 421 |
422 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { | 422 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { |
423 EXPECT_TRUE(service_->HasTokenForService("my_service")); | 423 EXPECT_TRUE(service_->HasTokenForService("my_service")); |
424 EXPECT_EQ("my_value", service_->GetTokenForService("my_service")); | 424 EXPECT_EQ("my_value", service_->GetTokenForService("my_service")); |
425 } | 425 } |
426 #endif // ifndef NDEBUG | 426 #endif // ifndef NDEBUG |
OLD | NEW |