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

Side by Side Diff: mojo/edk/system/message_pipe_dispatcher_unittest.cc

Issue 2056763003: EDK: Change Awakable::Awake()'s context, etc., to be a uint64_t. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: doh Created 4 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
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.cc ('k') | mojo/edk/system/message_pipe_endpoint.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 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a 5 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a
6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to 6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to
7 // increase tolerance and reduce observed flakiness (though doing so reduces the 7 // increase tolerance and reduce observed flakiness (though doing so reduces the
8 // meaningfulness of the test). 8 // meaningfulness of the test).
9 9
10 #include "mojo/edk/system/message_pipe_dispatcher.h" 10 #include "mojo/edk/system/message_pipe_dispatcher.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 MessagePipeDispatcher::kDefaultCreateOptions); 50 MessagePipeDispatcher::kDefaultCreateOptions);
51 EXPECT_EQ(Dispatcher::Type::MESSAGE_PIPE, d0->GetType()); 51 EXPECT_EQ(Dispatcher::Type::MESSAGE_PIPE, d0->GetType());
52 auto d1 = MessagePipeDispatcher::Create( 52 auto d1 = MessagePipeDispatcher::Create(
53 MessagePipeDispatcher::kDefaultCreateOptions); 53 MessagePipeDispatcher::kDefaultCreateOptions);
54 { 54 {
55 auto mp = MessagePipe::CreateLocalLocal(); 55 auto mp = MessagePipe::CreateLocalLocal();
56 d0->Init(mp.Clone(), i); // 0, 1. 56 d0->Init(mp.Clone(), i); // 0, 1.
57 d1->Init(std::move(mp), i ^ 1); // 1, 0. 57 d1->Init(std::move(mp), i ^ 1); // 1, 0.
58 } 58 }
59 Waiter w; 59 Waiter w;
60 uint32_t context = 0; 60 uint64_t context = 0;
61 HandleSignalsState hss; 61 HandleSignalsState hss;
62 62
63 // Try adding a writable waiter when already writable. 63 // Try adding a writable waiter when already writable.
64 w.Init(); 64 w.Init();
65 hss = HandleSignalsState(); 65 hss = HandleSignalsState();
66 EXPECT_EQ(MOJO_RESULT_ALREADY_EXISTS, 66 EXPECT_EQ(MOJO_RESULT_ALREADY_EXISTS,
67 d0->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &hss)); 67 d0->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &hss));
68 EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals); 68 EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
69 EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE | 69 EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE |
70 MOJO_HANDLE_SIGNAL_PEER_CLOSED, 70 MOJO_HANDLE_SIGNAL_PEER_CLOSED,
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 385 }
386 386
387 TEST(MessagePipeDispatcherTest, BasicThreaded) { 387 TEST(MessagePipeDispatcherTest, BasicThreaded) {
388 Stopwatch stopwatch; 388 Stopwatch stopwatch;
389 int32_t buffer[1]; 389 int32_t buffer[1];
390 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); 390 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
391 uint32_t buffer_size; 391 uint32_t buffer_size;
392 MojoDeadline elapsed; 392 MojoDeadline elapsed;
393 bool did_wait; 393 bool did_wait;
394 MojoResult result; 394 MojoResult result;
395 uint32_t context; 395 uint64_t context;
396 HandleSignalsState hss; 396 HandleSignalsState hss;
397 397
398 // Run this test both with |d0| as port 0, |d1| as port 1 and vice versa. 398 // Run this test both with |d0| as port 0, |d1| as port 1 and vice versa.
399 for (unsigned i = 0; i < 2; i++) { 399 for (unsigned i = 0; i < 2; i++) {
400 auto d0 = MessagePipeDispatcher::Create( 400 auto d0 = MessagePipeDispatcher::Create(
401 MessagePipeDispatcher::kDefaultCreateOptions); 401 MessagePipeDispatcher::kDefaultCreateOptions);
402 auto d1 = MessagePipeDispatcher::Create( 402 auto d1 = MessagePipeDispatcher::Create(
403 MessagePipeDispatcher::kDefaultCreateOptions); 403 MessagePipeDispatcher::kDefaultCreateOptions);
404 { 404 {
405 auto mp = MessagePipe::CreateLocalLocal(); 405 auto mp = MessagePipe::CreateLocalLocal();
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 EXPECT_EQ(total_messages_written, total_messages_read); 722 EXPECT_EQ(total_messages_written, total_messages_read);
723 EXPECT_EQ(total_bytes_written, total_bytes_read); 723 EXPECT_EQ(total_bytes_written, total_bytes_read);
724 724
725 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close()); 725 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close());
726 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close()); 726 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close());
727 } 727 }
728 728
729 } // namespace 729 } // namespace
730 } // namespace system 730 } // namespace system
731 } // namespace mojo 731 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.cc ('k') | mojo/edk/system/message_pipe_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698