| OLD | NEW |
| 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/setup/me2me_native_messaging_host.h" | 5 #include "remoting/host/setup/me2me_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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 return nullptr; | 402 return nullptr; |
| 403 } | 403 } |
| 404 | 404 |
| 405 return make_scoped_ptr( | 405 return make_scoped_ptr( |
| 406 static_cast<base::DictionaryValue*>(message.release())); | 406 static_cast<base::DictionaryValue*>(message.release())); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void Me2MeNativeMessagingHostTest::WriteMessageToInputPipe( | 409 void Me2MeNativeMessagingHostTest::WriteMessageToInputPipe( |
| 410 const base::Value& message) { | 410 const base::Value& message) { |
| 411 std::string message_json; | 411 std::string message_json; |
| 412 base::JSONWriter::Write(&message, &message_json); | 412 base::JSONWriter::Write(message, &message_json); |
| 413 | 413 |
| 414 uint32 length = message_json.length(); | 414 uint32 length = message_json.length(); |
| 415 input_write_file_.WriteAtCurrentPos(reinterpret_cast<char*>(&length), | 415 input_write_file_.WriteAtCurrentPos(reinterpret_cast<char*>(&length), |
| 416 sizeof(length)); | 416 sizeof(length)); |
| 417 input_write_file_.WriteAtCurrentPos(message_json.data(), length); | 417 input_write_file_.WriteAtCurrentPos(message_json.data(), length); |
| 418 } | 418 } |
| 419 | 419 |
| 420 void Me2MeNativeMessagingHostTest::TestBadRequest(const base::Value& message) { | 420 void Me2MeNativeMessagingHostTest::TestBadRequest(const base::Value& message) { |
| 421 base::DictionaryValue good_message; | 421 base::DictionaryValue good_message; |
| 422 good_message.SetString("type", "hello"); | 422 good_message.SetString("type", "hello"); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 609 } |
| 610 | 610 |
| 611 // Verify rejection if getCredentialsFromAuthCode has no auth code. | 611 // Verify rejection if getCredentialsFromAuthCode has no auth code. |
| 612 TEST_F(Me2MeNativeMessagingHostTest, GetCredentialsFromAuthCodeNoAuthCode) { | 612 TEST_F(Me2MeNativeMessagingHostTest, GetCredentialsFromAuthCodeNoAuthCode) { |
| 613 base::DictionaryValue message; | 613 base::DictionaryValue message; |
| 614 message.SetString("type", "getCredentialsFromAuthCode"); | 614 message.SetString("type", "getCredentialsFromAuthCode"); |
| 615 TestBadRequest(message); | 615 TestBadRequest(message); |
| 616 } | 616 } |
| 617 | 617 |
| 618 } // namespace remoting | 618 } // namespace remoting |
| OLD | NEW |