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

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

Issue 336313007: Mojo: Rename MOJO_WAIT_FLAG_... -> MOJO_HANDLE_SIGNAL_.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 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/spy/spy.cc ('k') | mojo/system/core_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/system/channel.h" 5 #include "mojo/system/channel.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "mojo/embedder/platform_channel_pair.h" 10 #include "mojo/embedder/platform_channel_pair.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // an |AttachMessagePipeEndpoint()| (which is actually incorrect). We need to 257 // an |AttachMessagePipeEndpoint()| (which is actually incorrect). We need to
258 // refactor |AttachMessagePipeEndpoint()| to indicate whether |Run...()| will 258 // refactor |AttachMessagePipeEndpoint()| to indicate whether |Run...()| will
259 // necessarily be called or not. (Then, in the case that it may not be called, 259 // necessarily be called or not. (Then, in the case that it may not be called,
260 // we should test a |Shutdown()| without the |Run...()|.) 260 // we should test a |Shutdown()| without the |Run...()|.)
261 EXPECT_TRUE(channel()->RunMessagePipeEndpoint(local_id, 261 EXPECT_TRUE(channel()->RunMessagePipeEndpoint(local_id,
262 Channel::kBootstrapEndpointId)); 262 Channel::kBootstrapEndpointId));
263 263
264 Waiter waiter; 264 Waiter waiter;
265 waiter.Init(); 265 waiter.Init();
266 EXPECT_EQ(MOJO_RESULT_OK, 266 EXPECT_EQ(MOJO_RESULT_OK,
267 mp->AddWaiter(0, &waiter, MOJO_WAIT_FLAG_READABLE, 123)); 267 mp->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123));
268 268
269 // Don't wait for the shutdown to run ... 269 // Don't wait for the shutdown to run ...
270 io_thread()->PostTask(FROM_HERE, 270 io_thread()->PostTask(FROM_HERE,
271 base::Bind(&ChannelTest::ShutdownChannelOnIOThread, 271 base::Bind(&ChannelTest::ShutdownChannelOnIOThread,
272 base::Unretained(this))); 272 base::Unretained(this)));
273 273
274 // ... since this |Wait()| should fail once the channel is shut down. 274 // ... since this |Wait()| should fail once the channel is shut down.
275 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, 275 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
276 waiter.Wait(MOJO_DEADLINE_INDEFINITE, NULL)); 276 waiter.Wait(MOJO_DEADLINE_INDEFINITE, NULL));
277 mp->RemoveWaiter(0, &waiter); 277 mp->RemoveWaiter(0, &waiter);
(...skipping 30 matching lines...) Expand all
308 Channel::kBootstrapEndpointId)); 308 Channel::kBootstrapEndpointId));
309 309
310 io_thread()->PostTaskAndWait( 310 io_thread()->PostTaskAndWait(
311 FROM_HERE, 311 FROM_HERE,
312 base::Bind(&ChannelTest::ShutdownChannelOnIOThread, 312 base::Bind(&ChannelTest::ShutdownChannelOnIOThread,
313 base::Unretained(this))); 313 base::Unretained(this)));
314 314
315 Waiter waiter; 315 Waiter waiter;
316 waiter.Init(); 316 waiter.Init();
317 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, 317 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
318 mp->AddWaiter(0, &waiter, MOJO_WAIT_FLAG_READABLE, 123)); 318 mp->AddWaiter(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123));
319 319
320 mp->Close(0); 320 mp->Close(0);
321 321
322 EXPECT_TRUE(channel()->HasOneRef()); 322 EXPECT_TRUE(channel()->HasOneRef());
323 } 323 }
324 324
325 // TODO(vtl): More. ------------------------------------------------------------ 325 // TODO(vtl): More. ------------------------------------------------------------
326 326
327 } // namespace 327 } // namespace
328 } // namespace system 328 } // namespace system
329 } // namespace mojo 329 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/spy/spy.cc ('k') | mojo/system/core_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698