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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cstdint> | 9 #include <cstdint> |
10 #include <memory> | 10 #include <memory> |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 while (true) { | 411 while (true) { |
412 uint32_t length; | 412 uint32_t length; |
413 int read_result = output_read_file_.ReadAtCurrentPos( | 413 int read_result = output_read_file_.ReadAtCurrentPos( |
414 reinterpret_cast<char*>(&length), sizeof(length)); | 414 reinterpret_cast<char*>(&length), sizeof(length)); |
415 if (read_result != sizeof(length)) { | 415 if (read_result != sizeof(length)) { |
416 return nullptr; | 416 return nullptr; |
417 } | 417 } |
418 | 418 |
419 std::string message_json(length, '\0'); | 419 std::string message_json(length, '\0'); |
420 read_result = output_read_file_.ReadAtCurrentPos( | 420 read_result = output_read_file_.ReadAtCurrentPos( |
421 string_as_array(&message_json), length); | 421 base::string_as_array(&message_json), length); |
422 if (read_result != static_cast<int>(length)) { | 422 if (read_result != static_cast<int>(length)) { |
423 return nullptr; | 423 return nullptr; |
424 } | 424 } |
425 | 425 |
426 std::unique_ptr<base::Value> message = base::JSONReader::Read(message_json); | 426 std::unique_ptr<base::Value> message = base::JSONReader::Read(message_json); |
427 if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) { | 427 if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) { |
428 return nullptr; | 428 return nullptr; |
429 } | 429 } |
430 | 430 |
431 std::unique_ptr<base::DictionaryValue> result = base::WrapUnique( | 431 std::unique_ptr<base::DictionaryValue> result = base::WrapUnique( |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 } | 643 } |
644 | 644 |
645 // Verify rejection if getCredentialsFromAuthCode has no auth code. | 645 // Verify rejection if getCredentialsFromAuthCode has no auth code. |
646 TEST_F(Me2MeNativeMessagingHostTest, GetCredentialsFromAuthCodeNoAuthCode) { | 646 TEST_F(Me2MeNativeMessagingHostTest, GetCredentialsFromAuthCodeNoAuthCode) { |
647 base::DictionaryValue message; | 647 base::DictionaryValue message; |
648 message.SetString("type", "getCredentialsFromAuthCode"); | 648 message.SetString("type", "getCredentialsFromAuthCode"); |
649 TestBadRequest(message); | 649 TestBadRequest(message); |
650 } | 650 } |
651 | 651 |
652 } // namespace remoting | 652 } // namespace remoting |
OLD | NEW |