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

Side by Side Diff: chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad rebase Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/message_loop.h" 7 #include "base/message_loop/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/chromeos/policy/device_policy_builder.h" 10 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 request_context_getter_.get(), scoped_testing_local_state_.Get())); 111 request_context_getter_.get(), scoped_testing_local_state_.Get()));
112 oauth2_service_->max_refresh_token_validation_retries_ = 0; 112 oauth2_service_->max_refresh_token_validation_retries_ = 0;
113 oauth2_service_->set_max_authorization_token_fetch_retries_for_testing(0); 113 oauth2_service_->set_max_authorization_token_fetch_retries_for_testing(0);
114 } 114 }
115 115
116 // Utility method to set a value in Local State for the device refresh token 116 // Utility method to set a value in Local State for the device refresh token
117 // (it must have a non-empty value or it won't be used). 117 // (it must have a non-empty value or it won't be used).
118 void SetDeviceRefreshTokenInLocalState(const std::string& refresh_token) { 118 void SetDeviceRefreshTokenInLocalState(const std::string& refresh_token) {
119 scoped_testing_local_state_.Get()->SetUserPref( 119 scoped_testing_local_state_.Get()->SetUserPref(
120 prefs::kDeviceRobotAnyApiRefreshToken, 120 prefs::kDeviceRobotAnyApiRefreshToken,
121 base::Value::CreateStringValue(refresh_token)); 121 new base::StringValue(refresh_token));
122 } 122 }
123 123
124 std::string GetValidTokenInfoResponse(const std::string email) { 124 std::string GetValidTokenInfoResponse(const std::string email) {
125 return "{ \"email\": \"" + email + "\"," 125 return "{ \"email\": \"" + email + "\","
126 " \"user_id\": \"1234567890\" }"; 126 " \"user_id\": \"1234567890\" }";
127 } 127 }
128 128
129 bool RefreshTokenIsAvailable() { 129 bool RefreshTokenIsAvailable() {
130 return oauth2_service_->RefreshTokenIsAvailable( 130 return oauth2_service_->RefreshTokenIsAvailable(
131 oauth2_service_->GetRobotAccountId()); 131 oauth2_service_->GetRobotAccountId());
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 424
425 AssertConsumerTokensAndErrors(0, 1); 425 AssertConsumerTokensAndErrors(0, 1);
426 426
427 // Retry should succeed. 427 // Retry should succeed.
428 request = StartTokenRequest(); 428 request = StartTokenRequest();
429 PerformURLFetches(); 429 PerformURLFetches();
430 AssertConsumerTokensAndErrors(1, 1); 430 AssertConsumerTokensAndErrors(1, 1);
431 } 431 }
432 432
433 } // namespace chromeos 433 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698