| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 5 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/prefs/testing_pref_service.h" | 8 #include "base/prefs/testing_pref_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/browser/signin/oauth2_token_service_test_util.h" | 10 #include "chrome/browser/signin/oauth2_token_service_test_util.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 DISALLOW_COPY_AND_ASSIGN(TestDeviceOAuth2TokenService); | 54 DISALLOW_COPY_AND_ASSIGN(TestDeviceOAuth2TokenService); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 class DeviceOAuth2TokenServiceTest : public testing::Test { | 57 class DeviceOAuth2TokenServiceTest : public testing::Test { |
| 58 public: | 58 public: |
| 59 DeviceOAuth2TokenServiceTest() | 59 DeviceOAuth2TokenServiceTest() |
| 60 : ui_thread_(content::BrowserThread::UI, &message_loop_), | 60 : ui_thread_(content::BrowserThread::UI, &message_loop_), |
| 61 scoped_testing_local_state_(TestingBrowserProcess::GetGlobal()), | 61 scoped_testing_local_state_(TestingBrowserProcess::GetGlobal()), |
| 62 request_context_getter_(new net::TestURLRequestContextGetter( | 62 request_context_getter_(new net::TestURLRequestContextGetter( |
| 63 message_loop_.message_loop_proxy())), | 63 message_loop_.message_loop_proxy())), |
| 64 oauth2_service_(request_context_getter_, | 64 oauth2_service_(request_context_getter_.get(), |
| 65 scoped_testing_local_state_.Get()) { | 65 scoped_testing_local_state_.Get()) { |
| 66 oauth2_service_.max_refresh_token_validation_retries_ = 0; | 66 oauth2_service_.max_refresh_token_validation_retries_ = 0; |
| 67 oauth2_service_.set_max_authorization_token_fetch_retries_for_testing(0); | 67 oauth2_service_.set_max_authorization_token_fetch_retries_for_testing(0); |
| 68 } | 68 } |
| 69 virtual ~DeviceOAuth2TokenServiceTest() {} | 69 virtual ~DeviceOAuth2TokenServiceTest() {} |
| 70 | 70 |
| 71 // Most tests just want a noop crypto impl with a dummy refresh token value in | 71 // Most tests just want a noop crypto impl with a dummy refresh token value in |
| 72 // Local State (if the value is an empty string, it will be ignored). | 72 // Local State (if the value is an empty string, it will be ignored). |
| 73 void SetUpDefaultValues() { | 73 void SetUpDefaultValues() { |
| 74 cryptohome_library_.reset(chromeos::CryptohomeLibrary::GetTestImpl()); | 74 cryptohome_library_.reset(chromeos::CryptohomeLibrary::GetTestImpl()); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 kValidatorUrlFetcherId, | 359 kValidatorUrlFetcherId, |
| 360 net::HTTP_OK, | 360 net::HTTP_OK, |
| 361 GetValidTokenInfoResponse("service_acct@g.com")); | 361 GetValidTokenInfoResponse("service_acct@g.com")); |
| 362 | 362 |
| 363 // All fetches were successful, but consumer still given error since | 363 // All fetches were successful, but consumer still given error since |
| 364 // the token owner doesn't match the policy value. | 364 // the token owner doesn't match the policy value. |
| 365 AssertConsumerTokensAndErrors(0, 1); | 365 AssertConsumerTokensAndErrors(0, 1); |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace chromeos | 368 } // namespace chromeos |
| OLD | NEW |