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

Side by Side Diff: mojo/edk/embedder/embedder_unittest.cc

Issue 1367523003: EDK: mostly style fix: change TestIOThread::Mode to an enum class. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | mojo/edk/system/channel_test_base.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/edk/embedder/embedder.h" 5 #include "mojo/edk/embedder/embedder.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 ChannelInfo* channel_info_; 124 ChannelInfo* channel_info_;
125 125
126 // Whether the destructor should wait until the channel is destroyed. 126 // Whether the destructor should wait until the channel is destroyed.
127 bool wait_on_shutdown_; 127 bool wait_on_shutdown_;
128 128
129 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedTestChannel); 129 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedTestChannel);
130 }; 130 };
131 131
132 class EmbedderTest : public testing::Test { 132 class EmbedderTest : public testing::Test {
133 public: 133 public:
134 EmbedderTest() : test_io_thread_(TestIOThread::kAutoStart) {} 134 EmbedderTest() : test_io_thread_(TestIOThread::StartMode::AUTO) {}
135 ~EmbedderTest() override {} 135 ~EmbedderTest() override {}
136 136
137 protected: 137 protected:
138 TestIOThread& test_io_thread() { return test_io_thread_; } 138 TestIOThread& test_io_thread() { return test_io_thread_; }
139 scoped_refptr<base::TaskRunner> test_io_task_runner() { 139 scoped_refptr<base::TaskRunner> test_io_task_runner() {
140 return test_io_thread_.task_runner(); 140 return test_io_thread_.task_runner();
141 } 141 }
142 142
143 private: 143 private:
144 void SetUp() override { test::InitWithSimplePlatformSupport(); } 144 void SetUp() override { test::InitWithSimplePlatformSupport(); }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 server_channel.reset(); 470 server_channel.reset();
471 MojoClose(server_mp); 471 MojoClose(server_mp);
472 } 472 }
473 } 473 }
474 474
475 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessMasterSlave) { 475 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessMasterSlave) {
476 ScopedPlatformHandle client_platform_handle = 476 ScopedPlatformHandle client_platform_handle =
477 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); 477 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass();
478 EXPECT_TRUE(client_platform_handle.is_valid()); 478 EXPECT_TRUE(client_platform_handle.is_valid());
479 479
480 TestIOThread test_io_thread(TestIOThread::kAutoStart); 480 TestIOThread test_io_thread(TestIOThread::StartMode::AUTO);
481 test::InitWithSimplePlatformSupport(); 481 test::InitWithSimplePlatformSupport();
482 482
483 { 483 {
484 mojo::test::ScopedSlaveIPCSupport ipc_support( 484 mojo::test::ScopedSlaveIPCSupport ipc_support(
485 test_io_thread.task_runner(), client_platform_handle.Pass()); 485 test_io_thread.task_runner(), client_platform_handle.Pass());
486 486
487 const base::CommandLine& command_line = 487 const base::CommandLine& command_line =
488 *base::CommandLine::ForCurrentProcess(); 488 *base::CommandLine::ForCurrentProcess();
489 ASSERT_TRUE(command_line.HasSwitch(kConnectionIdFlag)); 489 ASSERT_TRUE(command_line.HasSwitch(kConnectionIdFlag));
490 std::string connection_id = 490 std::string connection_id =
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 665 }
666 666
667 EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown()); 667 EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown());
668 } 668 }
669 669
670 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) { 670 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
671 ScopedPlatformHandle client_platform_handle = 671 ScopedPlatformHandle client_platform_handle =
672 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); 672 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass();
673 EXPECT_TRUE(client_platform_handle.is_valid()); 673 EXPECT_TRUE(client_platform_handle.is_valid());
674 674
675 TestIOThread test_io_thread(TestIOThread::kAutoStart); 675 TestIOThread test_io_thread(TestIOThread::StartMode::AUTO);
676 test::InitWithSimplePlatformSupport(); 676 test::InitWithSimplePlatformSupport();
677 677
678 { 678 {
679 // TODO(vtl): This should eventually initialize a slave process instead, 679 // TODO(vtl): This should eventually initialize a slave process instead,
680 // probably. 680 // probably.
681 mojo::test::ScopedIPCSupport ipc_support(test_io_thread.task_runner()); 681 mojo::test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
682 682
683 ScopedTestChannel client_channel(client_platform_handle.Pass()); 683 ScopedTestChannel client_channel(client_platform_handle.Pass());
684 MojoHandle client_mp = client_channel.bootstrap_message_pipe(); 684 MojoHandle client_mp = client_channel.bootstrap_message_pipe();
685 EXPECT_NE(client_mp, MOJO_HANDLE_INVALID); 685 EXPECT_NE(client_mp, MOJO_HANDLE_INVALID);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 785
786 EXPECT_TRUE(test::Shutdown()); 786 EXPECT_TRUE(test::Shutdown());
787 } 787 }
788 788
789 // TODO(vtl): Test immediate write & close. 789 // TODO(vtl): Test immediate write & close.
790 // TODO(vtl): Test broken-connection cases. 790 // TODO(vtl): Test broken-connection cases.
791 791
792 } // namespace 792 } // namespace
793 } // namespace embedder 793 } // namespace embedder
794 } // namespace mojo 794 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/channel_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698