| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #if defined(OS_MACOSX) | 57 #if defined(OS_MACOSX) |
| 58 Encryptor::UseMockKeychain(true); | 58 Encryptor::UseMockKeychain(true); |
| 59 #endif | 59 #endif |
| 60 credentials_.sid = "sid"; | 60 credentials_.sid = "sid"; |
| 61 credentials_.lsid = "lsid"; | 61 credentials_.lsid = "lsid"; |
| 62 credentials_.token = "token"; | 62 credentials_.token = "token"; |
| 63 credentials_.data = "data"; | 63 credentials_.data = "data"; |
| 64 oauth_token_ = "oauth"; | 64 oauth_token_ = "oauth"; |
| 65 oauth_secret_ = "secret"; | 65 oauth_secret_ = "secret"; |
| 66 | 66 |
| 67 profile_.reset(new TestingProfile()); | 67 if (!profile_) |
| 68 profile_.reset(new TestingProfile()); |
| 69 |
| 68 profile_->CreateWebDataService(); | 70 profile_->CreateWebDataService(); |
| 69 | 71 |
| 70 // Force the loading of the WebDataService. | 72 // Force the loading of the WebDataService. |
| 71 TokenWebData::FromBrowserContext(profile_.get()); | 73 TokenWebData::FromBrowserContext(profile_.get()); |
| 72 base::RunLoop().RunUntilIdle(); | 74 base::RunLoop().RunUntilIdle(); |
| 73 | 75 |
| 74 service_ = TokenServiceFactory::GetForProfile(profile_.get()); | 76 service_ = TokenServiceFactory::GetForProfile(profile_.get()); |
| 75 | 77 |
| 76 success_tracker_.ListenFor(chrome::NOTIFICATION_TOKEN_AVAILABLE, | 78 success_tracker_.ListenFor(chrome::NOTIFICATION_TOKEN_AVAILABLE, |
| 77 content::Source<TokenService>(service_)); | 79 content::Source<TokenService>(service_)); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 397 |
| 396 *CommandLine::ForCurrentProcess() = original_cl; | 398 *CommandLine::ForCurrentProcess() = original_cl; |
| 397 } | 399 } |
| 398 }; | 400 }; |
| 399 | 401 |
| 400 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { | 402 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { |
| 401 EXPECT_TRUE(service()->HasTokenForService("my_service")); | 403 EXPECT_TRUE(service()->HasTokenForService("my_service")); |
| 402 EXPECT_EQ("my_value", service()->GetTokenForService("my_service")); | 404 EXPECT_EQ("my_value", service()->GetTokenForService("my_service")); |
| 403 } | 405 } |
| 404 #endif // ifndef NDEBUG | 406 #endif // ifndef NDEBUG |
| OLD | NEW |