| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); | 225 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); |
| 226 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), | 226 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), |
| 227 "token2"); | 227 "token2"); |
| 228 | 228 |
| 229 service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, ""); | 229 service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, ""); |
| 230 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); | 230 EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); |
| 231 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), ""); | 231 EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), ""); |
| 232 } | 232 } |
| 233 | 233 |
| 234 TEST_F(TokenServiceTest, OnOAuth2LoginTokenSuccessUpdate) { | 234 TEST_F(TokenServiceTest, OnOAuth2LoginTokenSuccessUpdate) { |
| 235 std::string service = GaiaConstants::kGaiaOAuth2LoginRefreshToken; | 235 EXPECT_FALSE(service_->HasOAuthLoginToken()); |
| 236 |
| 236 service_->OnClientOAuthSuccess( | 237 service_->OnClientOAuthSuccess( |
| 237 GaiaAuthConsumer::ClientOAuthResult("rt1", "at1", 3600)); | 238 GaiaAuthConsumer::ClientOAuthResult("rt1", "at1", 3600)); |
| 238 EXPECT_TRUE(service_->HasOAuthLoginToken()); | 239 EXPECT_TRUE(service_->HasOAuthLoginToken()); |
| 239 EXPECT_EQ(service_->GetOAuth2LoginRefreshToken(), "rt1"); | 240 EXPECT_EQ(service_->GetOAuth2LoginRefreshToken(), "rt1"); |
| 240 | 241 |
| 241 service_->OnClientOAuthSuccess( | 242 service_->OnClientOAuthSuccess( |
| 242 GaiaAuthConsumer::ClientOAuthResult("rt2", "at2", 3600)); | 243 GaiaAuthConsumer::ClientOAuthResult("rt2", "at2", 3600)); |
| 243 EXPECT_TRUE(service_->HasOAuthLoginToken()); | 244 EXPECT_TRUE(service_->HasOAuthLoginToken()); |
| 244 EXPECT_EQ(service_->GetOAuth2LoginRefreshToken(), "rt2"); | 245 EXPECT_EQ(service_->GetOAuth2LoginRefreshToken(), "rt2"); |
| 245 | 246 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 419 |
| 419 *CommandLine::ForCurrentProcess() = original_cl; | 420 *CommandLine::ForCurrentProcess() = original_cl; |
| 420 } | 421 } |
| 421 }; | 422 }; |
| 422 | 423 |
| 423 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { | 424 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { |
| 424 EXPECT_TRUE(service_->HasTokenForService("my_service")); | 425 EXPECT_TRUE(service_->HasTokenForService("my_service")); |
| 425 EXPECT_EQ("my_value", service_->GetTokenForService("my_service")); | 426 EXPECT_EQ("my_value", service_->GetTokenForService("my_service")); |
| 426 } | 427 } |
| 427 #endif // ifndef NDEBUG | 428 #endif // ifndef NDEBUG |
| OLD | NEW |