| 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/it2me/it2me_native_messaging_host.h" | 5 #include "remoting/host/it2me/it2me_native_messaging_host.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) { | 363 if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) { |
| 364 LOG(ERROR) << "Malformed message:" << message_json; | 364 LOG(ERROR) << "Malformed message:" << message_json; |
| 365 return nullptr; | 365 return nullptr; |
| 366 } | 366 } |
| 367 | 367 |
| 368 std::unique_ptr<base::DictionaryValue> result = base::WrapUnique( | 368 std::unique_ptr<base::DictionaryValue> result = base::WrapUnique( |
| 369 static_cast<base::DictionaryValue*>(message.release())); | 369 static_cast<base::DictionaryValue*>(message.release())); |
| 370 std::string type; | 370 std::string type; |
| 371 // If this is a debug message log, ignore it, otherwise return it. | 371 // If this is a debug message log, ignore it, otherwise return it. |
| 372 if (!result->GetString("type", &type) || | 372 if (!result->GetString("type", &type) || |
| 373 type != LogMessageHandler::kDebugMessageTypeName) { | 373 type != LogMessageListener::kDebugMessageTypeName) { |
| 374 return result; | 374 return result; |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 | 378 |
| 379 void It2MeNativeMessagingHostTest::WriteMessageToInputPipe( | 379 void It2MeNativeMessagingHostTest::WriteMessageToInputPipe( |
| 380 const base::Value& message) { | 380 const base::Value& message) { |
| 381 std::string message_json; | 381 std::string message_json; |
| 382 base::JSONWriter::Write(message, &message_json); | 382 base::JSONWriter::Write(message, &message_json); |
| 383 | 383 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 } | 632 } |
| 633 | 633 |
| 634 // Verify rejection if type is unrecognized. | 634 // Verify rejection if type is unrecognized. |
| 635 TEST_F(It2MeNativeMessagingHostTest, InvalidType) { | 635 TEST_F(It2MeNativeMessagingHostTest, InvalidType) { |
| 636 base::DictionaryValue message; | 636 base::DictionaryValue message; |
| 637 message.SetString("type", "xxx"); | 637 message.SetString("type", "xxx"); |
| 638 TestBadRequest(message, true); | 638 TestBadRequest(message, true); |
| 639 } | 639 } |
| 640 | 640 |
| 641 } // namespace remoting | 641 } // namespace remoting |
| OLD | NEW |