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

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

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 3 years, 11 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/host/it2me/it2me_native_messaging_host.cc ('k') | remoting/host/logging_mac.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 <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
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
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
OLDNEW
« no previous file with comments | « remoting/host/it2me/it2me_native_messaging_host.cc ('k') | remoting/host/logging_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698