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

Side by Side Diff: mojo/system/remote_message_pipe_posix_unittest.cc

Issue 137063010: Mojo: Move platform handle/channel stuff in system to embedder namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/system/raw_channel_win.cc ('k') | mojo/system/scoped_platform_handle.h » ('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 // TODO(vtl): The POSIX-specific bits have been factored out. Apply this test to 5 // TODO(vtl): The POSIX-specific bits have been factored out. Apply this test to
6 // non-POSIX once we have a non-POSIX implementation. 6 // non-POSIX once we have a non-POSIX implementation.
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 io_thread_task_runner()->PostTask( 69 io_thread_task_runner()->PostTask(
70 FROM_HERE, 70 FROM_HERE,
71 base::Bind(&RemoteMessagePipeTest::BootstrapMessagePipeOnIOThread, 71 base::Bind(&RemoteMessagePipeTest::BootstrapMessagePipeOnIOThread,
72 base::Unretained(this), channel_index, mp)); 72 base::Unretained(this), channel_index, mp));
73 } 73 }
74 74
75 private: 75 private:
76 void SetUpOnIOThread() { 76 void SetUpOnIOThread() {
77 CHECK_EQ(base::MessageLoop::current(), io_thread_message_loop()); 77 CHECK_EQ(base::MessageLoop::current(), io_thread_message_loop());
78 78
79 PlatformChannelPair channel_pair; 79 embedder::PlatformChannelPair channel_pair;
80 platform_handles_[0] = channel_pair.PassServerHandle(); 80 platform_handles_[0] = channel_pair.PassServerHandle();
81 platform_handles_[1] = channel_pair.PassClientHandle(); 81 platform_handles_[1] = channel_pair.PassClientHandle();
82 } 82 }
83 83
84 void CreateAndInitChannel(unsigned channel_index) { 84 void CreateAndInitChannel(unsigned channel_index) {
85 CHECK_EQ(base::MessageLoop::current(), io_thread_message_loop()); 85 CHECK_EQ(base::MessageLoop::current(), io_thread_message_loop());
86 CHECK(channel_index == 0 || channel_index == 1); 86 CHECK(channel_index == 0 || channel_index == 1);
87 CHECK(!channels_[channel_index].get()); 87 CHECK(!channels_[channel_index].get());
88 88
89 channels_[channel_index] = new Channel(); 89 channels_[channel_index] = new Channel();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (channels_[0].get()) { 128 if (channels_[0].get()) {
129 channels_[0]->Shutdown(); 129 channels_[0]->Shutdown();
130 channels_[0] = NULL; 130 channels_[0] = NULL;
131 } 131 }
132 if (channels_[1].get()) { 132 if (channels_[1].get()) {
133 channels_[1]->Shutdown(); 133 channels_[1]->Shutdown();
134 channels_[1] = NULL; 134 channels_[1] = NULL;
135 } 135 }
136 } 136 }
137 137
138 ScopedPlatformHandle platform_handles_[2]; 138 embedder::ScopedPlatformHandle platform_handles_[2];
139 scoped_refptr<Channel> channels_[2]; 139 scoped_refptr<Channel> channels_[2];
140 140
141 DISALLOW_COPY_AND_ASSIGN(RemoteMessagePipeTest); 141 DISALLOW_COPY_AND_ASSIGN(RemoteMessagePipeTest);
142 }; 142 };
143 143
144 TEST_F(RemoteMessagePipeTest, Basic) { 144 TEST_F(RemoteMessagePipeTest, Basic) {
145 const char hello[] = "hello"; 145 const char hello[] = "hello";
146 const char world[] = "world!!!1!!!1!"; 146 const char world[] = "world!!!1!!!1!";
147 char buffer[100] = { 0 }; 147 char buffer[100] = { 0 };
148 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); 148 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 MOJO_READ_MESSAGE_FLAG_NONE)); 400 MOJO_READ_MESSAGE_FLAG_NONE));
401 EXPECT_EQ(sizeof(hello), static_cast<size_t>(buffer_size)); 401 EXPECT_EQ(sizeof(hello), static_cast<size_t>(buffer_size));
402 EXPECT_EQ(0, strcmp(buffer, hello)); 402 EXPECT_EQ(0, strcmp(buffer, hello));
403 403
404 // And MP 1, port 1. 404 // And MP 1, port 1.
405 mp_1->Close(1); 405 mp_1->Close(1);
406 } 406 }
407 } // namespace 407 } // namespace
408 } // namespace system 408 } // namespace system
409 } // namespace mojo 409 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/raw_channel_win.cc ('k') | mojo/system/scoped_platform_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698