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

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

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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
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 "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 // Utility method to set a value in Local State for the device refresh token 140 // Utility method to set a value in Local State for the device refresh token
141 // (it must have a non-empty value or it won't be used). 141 // (it must have a non-empty value or it won't be used).
142 void SetDeviceRefreshTokenInLocalState(const std::string& refresh_token) { 142 void SetDeviceRefreshTokenInLocalState(const std::string& refresh_token) {
143 scoped_testing_local_state_.Get()->SetUserPref( 143 scoped_testing_local_state_.Get()->SetUserPref(
144 prefs::kDeviceRobotAnyApiRefreshToken, 144 prefs::kDeviceRobotAnyApiRefreshToken,
145 new base::StringValue(refresh_token)); 145 new base::StringValue(refresh_token));
146 } 146 }
147 147
148 std::string GetValidTokenInfoResponse(const std::string email) { 148 std::string GetValidTokenInfoResponse(const std::string& email) {
149 return "{ \"email\": \"" + email + "\"," 149 return "{ \"email\": \"" + email + "\","
150 " \"user_id\": \"1234567890\" }"; 150 " \"user_id\": \"1234567890\" }";
151 } 151 }
152 152
153 bool RefreshTokenIsAvailable() { 153 bool RefreshTokenIsAvailable() {
154 return oauth2_service_->RefreshTokenIsAvailable( 154 return oauth2_service_->RefreshTokenIsAvailable(
155 oauth2_service_->GetRobotAccountId()); 155 oauth2_service_->GetRobotAccountId());
156 } 156 }
157 157
158 std::string GetRefreshToken() { 158 std::string GetRefreshToken() {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 // Also make the robot account ID available. Verify that the token is 470 // Also make the robot account ID available. Verify that the token is
471 // announced now. 471 // announced now.
472 EXPECT_CALL(observer, OnRefreshTokenAvailable("robot@example.com")); 472 EXPECT_CALL(observer, OnRefreshTokenAvailable("robot@example.com"));
473 SetRobotAccountId("robot@example.com"); 473 SetRobotAccountId("robot@example.com");
474 testing::Mock::VerifyAndClearExpectations(&observer); 474 testing::Mock::VerifyAndClearExpectations(&observer);
475 475
476 oauth2_service_->RemoveObserver(&observer); 476 oauth2_service_->RemoveObserver(&observer);
477 } 477 }
478 478
479 } // namespace chromeos 479 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698