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

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

Issue 2075353002: Plumb the handle signals state out of Waiter::Wait(). (Closed) Base URL: https://github.com/domokit/mojo.git@work795_wait_set_4.3-x-work794_wait_set_4.2
Patch Set: 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 | « no previous file | mojo/edk/system/core.cc » ('j') | mojo/edk/system/waiter.cc » ('J')
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/system/channel.h" 5 #include "mojo/edk/system/channel.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "mojo/edk/system/channel_endpoint.h" 9 #include "mojo/edk/system/channel_endpoint.h"
10 #include "mojo/edk/system/channel_endpoint_id.h" 10 #include "mojo/edk/system/channel_endpoint_id.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 waiter.Init(); 65 waiter.Init();
66 ASSERT_EQ(MOJO_RESULT_OK, 66 ASSERT_EQ(MOJO_RESULT_OK,
67 mp->AddAwakable(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, false, 123, 67 mp->AddAwakable(0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, false, 123,
68 nullptr)); 68 nullptr));
69 69
70 // Don't wait for the shutdown to run ... 70 // Don't wait for the shutdown to run ...
71 io_thread()->PostTaskAndWait([this]() { ShutdownChannelOnIOThread(0); }); 71 io_thread()->PostTaskAndWait([this]() { ShutdownChannelOnIOThread(0); });
72 72
73 // ... since this |Wait()| should fail once the channel is shut down. 73 // ... since this |Wait()| should fail once the channel is shut down.
74 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, 74 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
75 waiter.Wait(MOJO_DEADLINE_INDEFINITE, nullptr)); 75 waiter.Wait(MOJO_DEADLINE_INDEFINITE, nullptr, nullptr));
76 HandleSignalsState hss; 76 HandleSignalsState hss;
77 mp->RemoveAwakable(0, &waiter, &hss); 77 mp->RemoveAwakable(0, &waiter, &hss);
78 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); 78 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
79 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); 79 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
80 80
81 mp->Close(0); 81 mp->Close(0);
82 82
83 EXPECT_TRUE(channel(0)->HasOneRef()); 83 EXPECT_TRUE(channel(0)->HasOneRef());
84 } 84 }
85 85
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 io_thread()->PostTaskAndWait([]() {}); 132 io_thread()->PostTaskAndWait([]() {});
133 EXPECT_FALSE(channel(0)); 133 EXPECT_FALSE(channel(0));
134 } 134 }
135 } 135 }
136 136
137 // TODO(vtl): More. ------------------------------------------------------------ 137 // TODO(vtl): More. ------------------------------------------------------------
138 138
139 } // namespace 139 } // namespace
140 } // namespace system 140 } // namespace system
141 } // namespace mojo 141 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/core.cc » ('j') | mojo/edk/system/waiter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698