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

Side by Side Diff: remoting/host/it2me/it2me_native_messaging_host_unittest.cc

Issue 2230193002: remoting: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
« no previous file with comments | « remoting/codec/video_encoder_verbatim.cc ('k') | remoting/host/linux/audio_pipe_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 uint32_t length; 270 uint32_t length;
271 int read_result = output_read_file_.ReadAtCurrentPos( 271 int read_result = output_read_file_.ReadAtCurrentPos(
272 reinterpret_cast<char*>(&length), sizeof(length)); 272 reinterpret_cast<char*>(&length), sizeof(length));
273 if (read_result != sizeof(length)) { 273 if (read_result != sizeof(length)) {
274 // The output pipe has been closed, return an empty message. 274 // The output pipe has been closed, return an empty message.
275 return nullptr; 275 return nullptr;
276 } 276 }
277 277
278 std::string message_json(length, '\0'); 278 std::string message_json(length, '\0');
279 read_result = output_read_file_.ReadAtCurrentPos( 279 read_result = output_read_file_.ReadAtCurrentPos(
280 string_as_array(&message_json), length); 280 base::string_as_array(&message_json), length);
281 if (read_result != static_cast<int>(length)) { 281 if (read_result != static_cast<int>(length)) {
282 LOG(ERROR) << "Message size (" << read_result 282 LOG(ERROR) << "Message size (" << read_result
283 << ") doesn't match the header (" << length << ")."; 283 << ") doesn't match the header (" << length << ").";
284 return nullptr; 284 return nullptr;
285 } 285 }
286 286
287 std::unique_ptr<base::Value> message = base::JSONReader::Read(message_json); 287 std::unique_ptr<base::Value> message = base::JSONReader::Read(message_json);
288 if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) { 288 if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) {
289 LOG(ERROR) << "Malformed message:" << message_json; 289 LOG(ERROR) << "Malformed message:" << message_json;
290 return nullptr; 290 return nullptr;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 549 }
550 550
551 // Verify rejection if type is unrecognized. 551 // Verify rejection if type is unrecognized.
552 TEST_F(It2MeNativeMessagingHostTest, InvalidType) { 552 TEST_F(It2MeNativeMessagingHostTest, InvalidType) {
553 base::DictionaryValue message; 553 base::DictionaryValue message;
554 message.SetString("type", "xxx"); 554 message.SetString("type", "xxx");
555 TestBadRequest(message, true); 555 TestBadRequest(message, true);
556 } 556 }
557 557
558 } // namespace remoting 558 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/codec/video_encoder_verbatim.cc ('k') | remoting/host/linux/audio_pipe_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698