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

Side by Side Diff: remoting/host/token_validator_factory_impl_unittest.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 // A set of unit tests for TokenValidatorFactoryImpl 5 // A set of unit tests for TokenValidatorFactoryImpl
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 token_validator_factory_.reset(new TokenValidatorFactoryImpl( 101 token_validator_factory_.reset(new TokenValidatorFactoryImpl(
102 config, key_pair_, request_context_getter_)); 102 config, key_pair_, request_context_getter_));
103 } 103 }
104 104
105 static std::string CreateResponse(const std::string& scope) { 105 static std::string CreateResponse(const std::string& scope) {
106 base::DictionaryValue response_dict; 106 base::DictionaryValue response_dict;
107 response_dict.SetString("access_token", kSharedSecret); 107 response_dict.SetString("access_token", kSharedSecret);
108 response_dict.SetString("token_type", "shared_secret"); 108 response_dict.SetString("token_type", "shared_secret");
109 response_dict.SetString("scope", scope); 109 response_dict.SetString("scope", scope);
110 std::string response; 110 std::string response;
111 base::JSONWriter::Write(&response_dict, &response); 111 base::JSONWriter::Write(response_dict, &response);
112 return response; 112 return response;
113 } 113 }
114 114
115 static std::string CreateErrorResponse(const std::string& error) { 115 static std::string CreateErrorResponse(const std::string& error) {
116 base::DictionaryValue response_dict; 116 base::DictionaryValue response_dict;
117 response_dict.SetString("error", error); 117 response_dict.SetString("error", error);
118 std::string response; 118 std::string response;
119 base::JSONWriter::Write(&response_dict, &response); 119 base::JSONWriter::Write(response_dict, &response);
120 return response; 120 return response;
121 } 121 }
122 122
123 123
124 void SetResponse(const std::string& headers, const std::string& response) { 124 void SetResponse(const std::string& headers, const std::string& response) {
125 SetResponseURLRequestContext* context = 125 SetResponseURLRequestContext* context =
126 static_cast<SetResponseURLRequestContext*>( 126 static_cast<SetResponseURLRequestContext*>(
127 request_context_getter_->GetURLRequestContext()); 127 request_context_getter_->GetURLRequestContext());
128 context->SetResponse(headers, response); 128 context->SetResponse(headers, response);
129 } 129 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 SetResponse(net::URLRequestTestJob::test_error_headers(), std::string()); 180 SetResponse(net::URLRequestTestJob::test_error_headers(), std::string());
181 181
182 token_validator_->ValidateThirdPartyToken( 182 token_validator_->ValidateThirdPartyToken(
183 kToken, base::Bind( 183 kToken, base::Bind(
184 &TokenValidatorFactoryImplTest::DeleteOnFailureCallback, 184 &TokenValidatorFactoryImplTest::DeleteOnFailureCallback,
185 base::Unretained(this))); 185 base::Unretained(this)));
186 message_loop_.Run(); 186 message_loop_.Run();
187 } 187 }
188 188
189 } // namespace remoting 189 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/setup/service_client.cc ('k') | remoting/host/video_frame_recorder_host_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698