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

Side by Side Diff: remoting/host/setup/me2me_native_messaging_host_unittest.cc

Issue 810133003: replace NULL->nullptr in src/remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 EXPECT_EQ("generateKeyPairResponse", value); 64 EXPECT_EQ("generateKeyPairResponse", value);
65 EXPECT_TRUE(response->GetString("privateKey", &value)); 65 EXPECT_TRUE(response->GetString("privateKey", &value));
66 EXPECT_TRUE(response->GetString("publicKey", &value)); 66 EXPECT_TRUE(response->GetString("publicKey", &value));
67 } 67 }
68 68
69 void VerifyGetDaemonConfigResponse(scoped_ptr<base::DictionaryValue> response) { 69 void VerifyGetDaemonConfigResponse(scoped_ptr<base::DictionaryValue> response) {
70 ASSERT_TRUE(response); 70 ASSERT_TRUE(response);
71 std::string value; 71 std::string value;
72 EXPECT_TRUE(response->GetString("type", &value)); 72 EXPECT_TRUE(response->GetString("type", &value));
73 EXPECT_EQ("getDaemonConfigResponse", value); 73 EXPECT_EQ("getDaemonConfigResponse", value);
74 const base::DictionaryValue* config = NULL; 74 const base::DictionaryValue* config = nullptr;
75 EXPECT_TRUE(response->GetDictionary("config", &config)); 75 EXPECT_TRUE(response->GetDictionary("config", &config));
76 EXPECT_TRUE(base::DictionaryValue().Equals(config)); 76 EXPECT_TRUE(base::DictionaryValue().Equals(config));
77 } 77 }
78 78
79 void VerifyGetUsageStatsConsentResponse( 79 void VerifyGetUsageStatsConsentResponse(
80 scoped_ptr<base::DictionaryValue> response) { 80 scoped_ptr<base::DictionaryValue> response) {
81 ASSERT_TRUE(response); 81 ASSERT_TRUE(response);
82 std::string value; 82 std::string value;
83 EXPECT_TRUE(response->GetString("type", &value)); 83 EXPECT_TRUE(response->GetString("type", &value));
84 EXPECT_EQ("getUsageStatsConsentResponse", value); 84 EXPECT_EQ("getUsageStatsConsentResponse", value);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 void Me2MeNativeMessagingHostTest::StopHost() { 337 void Me2MeNativeMessagingHostTest::StopHost() {
338 DCHECK(host_task_runner_->RunsTasksOnCurrentThread()); 338 DCHECK(host_task_runner_->RunsTasksOnCurrentThread());
339 339
340 host_.reset(); 340 host_.reset();
341 341
342 // Wait till all shutdown tasks have completed. 342 // Wait till all shutdown tasks have completed.
343 base::RunLoop().RunUntilIdle(); 343 base::RunLoop().RunUntilIdle();
344 344
345 // Trigger a test shutdown via ExitTest(). 345 // Trigger a test shutdown via ExitTest().
346 host_task_runner_ = NULL; 346 host_task_runner_ = nullptr;
347 } 347 }
348 348
349 void Me2MeNativeMessagingHostTest::ExitTest() { 349 void Me2MeNativeMessagingHostTest::ExitTest() {
350 if (!test_message_loop_->message_loop_proxy()->RunsTasksOnCurrentThread()) { 350 if (!test_message_loop_->message_loop_proxy()->RunsTasksOnCurrentThread()) {
351 test_message_loop_->message_loop_proxy()->PostTask( 351 test_message_loop_->message_loop_proxy()->PostTask(
352 FROM_HERE, 352 FROM_HERE,
353 base::Bind(&Me2MeNativeMessagingHostTest::ExitTest, 353 base::Bind(&Me2MeNativeMessagingHostTest::ExitTest,
354 base::Unretained(this))); 354 base::Unretained(this)));
355 return; 355 return;
356 } 356 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // Make sure that id is available and is in the range. 506 // Make sure that id is available and is in the range.
507 int id; 507 int id;
508 ASSERT_TRUE(response->GetInteger("id", &id)); 508 ASSERT_TRUE(response->GetInteger("id", &id));
509 ASSERT_TRUE(0 <= id && id < next_id); 509 ASSERT_TRUE(0 <= id && id < next_id);
510 510
511 // Call the verification routine corresponding to the message id. 511 // Call the verification routine corresponding to the message id.
512 ASSERT_TRUE(verify_routines[id]); 512 ASSERT_TRUE(verify_routines[id]);
513 verify_routines[id](response.Pass()); 513 verify_routines[id](response.Pass());
514 514
515 // Clear the pointer so that the routine cannot be called the second time. 515 // Clear the pointer so that the routine cannot be called the second time.
516 verify_routines[id] = NULL; 516 verify_routines[id] = nullptr;
517 } 517 }
518 } 518 }
519 519
520 // Verify that response ID matches request ID. 520 // Verify that response ID matches request ID.
521 TEST_F(Me2MeNativeMessagingHostTest, Id) { 521 TEST_F(Me2MeNativeMessagingHostTest, Id) {
522 base::DictionaryValue message; 522 base::DictionaryValue message;
523 message.SetString("type", "hello"); 523 message.SetString("type", "hello");
524 WriteMessageToInputPipe(message); 524 WriteMessageToInputPipe(message);
525 message.SetString("id", "42"); 525 message.SetString("id", "42");
526 WriteMessageToInputPipe(message); 526 WriteMessageToInputPipe(message);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 590
591 // Verify rejection if startDaemon request has no "consent" parameter. 591 // Verify rejection if startDaemon request has no "consent" parameter.
592 TEST_F(Me2MeNativeMessagingHostTest, StartDaemonNoConsent) { 592 TEST_F(Me2MeNativeMessagingHostTest, StartDaemonNoConsent) {
593 base::DictionaryValue message; 593 base::DictionaryValue message;
594 message.SetString("type", "startDaemon"); 594 message.SetString("type", "startDaemon");
595 message.Set("config", base::DictionaryValue().DeepCopy()); 595 message.Set("config", base::DictionaryValue().DeepCopy());
596 TestBadRequest(message); 596 TestBadRequest(message);
597 } 597 }
598 598
599 } // namespace remoting 599 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/setup/me2me_native_messaging_host_main.cc ('k') | remoting/host/setup/service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698