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

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

Issue 488003003: Add ChannelProxy benchmark to ipc_perftests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Landing. Created 6 years, 3 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 | « ipc/mojo/ipc_channel_mojo_unittest.cc ('k') | mojo/system/channel_unittest.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/embedder/embedder.h" 5 #include "mojo/embedder/embedder.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
15 #include "base/test/test_io_thread.h"
15 #include "mojo/common/test/multiprocess_test_helper.h" 16 #include "mojo/common/test/multiprocess_test_helper.h"
16 #include "mojo/embedder/platform_channel_pair.h" 17 #include "mojo/embedder/platform_channel_pair.h"
17 #include "mojo/embedder/test_embedder.h" 18 #include "mojo/embedder/test_embedder.h"
18 #include "mojo/public/c/system/core.h" 19 #include "mojo/public/c/system/core.h"
19 #include "mojo/system/test_utils.h" 20 #include "mojo/system/test_utils.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 namespace mojo { 23 namespace mojo {
23 namespace embedder { 24 namespace embedder {
24 namespace { 25 namespace {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 base::WaitableEvent did_create_channel_event_; 94 base::WaitableEvent did_create_channel_event_;
94 95
95 // Valid after channel creation completion until destruction. 96 // Valid after channel creation completion until destruction.
96 ChannelInfo* channel_info_; 97 ChannelInfo* channel_info_;
97 98
98 DISALLOW_COPY_AND_ASSIGN(ScopedTestChannel); 99 DISALLOW_COPY_AND_ASSIGN(ScopedTestChannel);
99 }; 100 };
100 101
101 class EmbedderTest : public testing::Test { 102 class EmbedderTest : public testing::Test {
102 public: 103 public:
103 EmbedderTest() : test_io_thread_(system::test::TestIOThread::kAutoStart) {} 104 EmbedderTest() : test_io_thread_(base::TestIOThread::kAutoStart) {}
104 virtual ~EmbedderTest() {} 105 virtual ~EmbedderTest() {}
105 106
106 protected: 107 protected:
107 system::test::TestIOThread* test_io_thread() { return &test_io_thread_; } 108 base::TestIOThread* test_io_thread() { return &test_io_thread_; }
108 109
109 private: 110 private:
110 system::test::TestIOThread test_io_thread_; 111 base::TestIOThread test_io_thread_;
111 112
112 DISALLOW_COPY_AND_ASSIGN(EmbedderTest); 113 DISALLOW_COPY_AND_ASSIGN(EmbedderTest);
113 }; 114 };
114 115
115 TEST_F(EmbedderTest, ChannelsBasic) { 116 TEST_F(EmbedderTest, ChannelsBasic) {
116 mojo::embedder::test::InitWithSimplePlatformSupport(); 117 mojo::embedder::test::InitWithSimplePlatformSupport();
117 118
118 { 119 {
119 PlatformChannelPair channel_pair; 120 PlatformChannelPair channel_pair;
120 ScopedTestChannel server_channel(test_io_thread()->task_runner(), 121 ScopedTestChannel server_channel(test_io_thread()->task_runner(),
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 454
454 EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown()); 455 EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown());
455 EXPECT_TRUE(test::Shutdown()); 456 EXPECT_TRUE(test::Shutdown());
456 } 457 }
457 458
458 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) { 459 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
459 ScopedPlatformHandle client_platform_handle = 460 ScopedPlatformHandle client_platform_handle =
460 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); 461 mojo::test::MultiprocessTestHelper::client_platform_handle.Pass();
461 EXPECT_TRUE(client_platform_handle.is_valid()); 462 EXPECT_TRUE(client_platform_handle.is_valid());
462 463
463 system::test::TestIOThread test_io_thread( 464 base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
464 system::test::TestIOThread::kAutoStart);
465 mojo::embedder::test::InitWithSimplePlatformSupport(); 465 mojo::embedder::test::InitWithSimplePlatformSupport();
466 466
467 { 467 {
468 ScopedTestChannel client_channel(test_io_thread.task_runner(), 468 ScopedTestChannel client_channel(test_io_thread.task_runner(),
469 client_platform_handle.Pass()); 469 client_platform_handle.Pass());
470 MojoHandle client_mp = client_channel.bootstrap_message_pipe(); 470 MojoHandle client_mp = client_channel.bootstrap_message_pipe();
471 EXPECT_NE(client_mp, MOJO_HANDLE_INVALID); 471 EXPECT_NE(client_mp, MOJO_HANDLE_INVALID);
472 client_channel.WaitForChannelCreationCompletion(); 472 client_channel.WaitForChannelCreationCompletion();
473 CHECK(client_channel.channel_info() != NULL); 473 CHECK(client_channel.channel_info() != NULL);
474 474
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 581
582 EXPECT_TRUE(test::Shutdown()); 582 EXPECT_TRUE(test::Shutdown());
583 } 583 }
584 584
585 // TODO(vtl): Test immediate write & close. 585 // TODO(vtl): Test immediate write & close.
586 // TODO(vtl): Test broken-connection cases. 586 // TODO(vtl): Test broken-connection cases.
587 587
588 } // namespace 588 } // namespace
589 } // namespace embedder 589 } // namespace embedder
590 } // namespace mojo 590 } // namespace mojo
OLDNEW
« no previous file with comments | « ipc/mojo/ipc_channel_mojo_unittest.cc ('k') | mojo/system/channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698