Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: debug Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc b/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc
index 64c04d863c0bf18d1ca63fb05fe8d48f5ca679bd..f8848d3d88e769d5273758b3c9fc3c14192f634e 100644
--- a/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc
+++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc
@@ -10,6 +10,7 @@
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/chromeos/policy/device_policy_builder.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
+#include "chrome/browser/chromeos/settings/device_oauth2_token_service_delegate.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
#include "chrome/browser/chromeos/settings/token_encryptor.h"
@@ -128,9 +129,12 @@ class DeviceOAuth2TokenServiceTest : public testing::Test {
}
void CreateService() {
- oauth2_service_.reset(new DeviceOAuth2TokenService(
- request_context_getter_.get(), scoped_testing_local_state_.Get()));
- oauth2_service_->max_refresh_token_validation_retries_ = 0;
+ oauth2_service_.reset(
+ new DeviceOAuth2TokenService(new DeviceOAuth2TokenServiceDelegate(
+ request_context_getter_.get(), scoped_testing_local_state_.Get())));
+ static_cast<DeviceOAuth2TokenServiceDelegate*>(
Mattias Nissler (ping if slow) 2015/07/01 12:34:14 This is much cleaner if you just create the Device
gogerald1 2015/07/01 17:58:42 Done.
+ oauth2_service_->GetDelegate())->max_refresh_token_validation_retries_ =
+ 0;
oauth2_service_->set_max_authorization_token_fetch_retries_for_testing(0);
}
@@ -156,8 +160,9 @@ class DeviceOAuth2TokenServiceTest : public testing::Test {
if (!RefreshTokenIsAvailable())
return std::string();
- return oauth2_service_->GetRefreshToken(
- oauth2_service_->GetRobotAccountId());
+ return static_cast<DeviceOAuth2TokenServiceDelegate*>(
+ oauth2_service_->GetDelegate())
+ ->GetRefreshToken(oauth2_service_->GetRobotAccountId());
}
// A utility method to return fake URL results, for testing the refresh token

Powered by Google App Engine
This is Rietveld 408576698