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

Side by Side Diff: remoting/host/it2me/it2me_native_messaging_host_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 #include "remoting/host/it2me/it2me_native_messaging_host.h" 5 #include "remoting/host/it2me/it2me_native_messaging_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return nullptr; 284 return nullptr;
285 } 285 }
286 286
287 return make_scoped_ptr( 287 return make_scoped_ptr(
288 static_cast<base::DictionaryValue*>(message.release())); 288 static_cast<base::DictionaryValue*>(message.release()));
289 } 289 }
290 290
291 void It2MeNativeMessagingHostTest::WriteMessageToInputPipe( 291 void It2MeNativeMessagingHostTest::WriteMessageToInputPipe(
292 const base::Value& message) { 292 const base::Value& message) {
293 std::string message_json; 293 std::string message_json;
294 base::JSONWriter::Write(&message, &message_json); 294 base::JSONWriter::Write(message, &message_json);
295 295
296 uint32 length = message_json.length(); 296 uint32 length = message_json.length();
297 input_write_file_.WriteAtCurrentPos(reinterpret_cast<char*>(&length), 297 input_write_file_.WriteAtCurrentPos(reinterpret_cast<char*>(&length),
298 sizeof(length)); 298 sizeof(length));
299 input_write_file_.WriteAtCurrentPos(message_json.data(), length); 299 input_write_file_.WriteAtCurrentPos(message_json.data(), length);
300 } 300 }
301 301
302 void It2MeNativeMessagingHostTest::VerifyHelloResponse(int request_id) { 302 void It2MeNativeMessagingHostTest::VerifyHelloResponse(int request_id) {
303 scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe(); 303 scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
304 VerifyCommonProperties(response.Pass(), "helloResponse", request_id); 304 VerifyCommonProperties(response.Pass(), "helloResponse", request_id);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 // Verify rejection if type is unrecognized. 542 // Verify rejection if type is unrecognized.
543 TEST_F(It2MeNativeMessagingHostTest, InvalidType) { 543 TEST_F(It2MeNativeMessagingHostTest, InvalidType) {
544 base::DictionaryValue message; 544 base::DictionaryValue message;
545 message.SetString("type", "xxx"); 545 message.SetString("type", "xxx");
546 TestBadRequest(message, true); 546 TestBadRequest(message, true);
547 } 547 }
548 548
549 } // namespace remoting 549 } // namespace remoting
550 550
OLDNEW
« no previous file with comments | « remoting/host/it2me/it2me_native_messaging_host.cc ('k') | remoting/host/native_messaging/native_messaging_pipe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698