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

Side by Side Diff: mojo/public/cpp/bindings/tests/handle_passing_unittest.cc

Issue 2741353002: Mojo: Add signal for new data pipe consumer data (Closed)
Patch Set: rebase Created 3 years, 9 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/public/c/system/types.h ('k') | no next file » | 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 #include <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 const DoStuff2Callback& callback) override { 106 const DoStuff2Callback& callback) override {
107 // Read the data from the pipe, writing the response (as a string) to 107 // Read the data from the pipe, writing the response (as a string) to
108 // DidStuff2(). 108 // DidStuff2().
109 ASSERT_TRUE(pipe.is_valid()); 109 ASSERT_TRUE(pipe.is_valid());
110 uint32_t data_size = 0; 110 uint32_t data_size = 0;
111 111
112 MojoHandleSignalsState state; 112 MojoHandleSignalsState state;
113 ASSERT_EQ(MOJO_RESULT_OK, 113 ASSERT_EQ(MOJO_RESULT_OK,
114 MojoWait(pipe.get().value(), MOJO_HANDLE_SIGNAL_READABLE, 114 MojoWait(pipe.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
115 MOJO_DEADLINE_INDEFINITE, &state)); 115 MOJO_DEADLINE_INDEFINITE, &state));
116 ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, state.satisfied_signals); 116 ASSERT_TRUE(state.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE);
117 ASSERT_EQ(MOJO_RESULT_OK, 117 ASSERT_EQ(MOJO_RESULT_OK,
118 ReadDataRaw( 118 ReadDataRaw(
119 pipe.get(), nullptr, &data_size, MOJO_READ_DATA_FLAG_QUERY)); 119 pipe.get(), nullptr, &data_size, MOJO_READ_DATA_FLAG_QUERY));
120 ASSERT_NE(0, static_cast<int>(data_size)); 120 ASSERT_NE(0, static_cast<int>(data_size));
121 char data[64]; 121 char data[64];
122 ASSERT_LT(static_cast<int>(data_size), 64); 122 ASSERT_LT(static_cast<int>(data_size), 64);
123 ASSERT_EQ( 123 ASSERT_EQ(
124 MOJO_RESULT_OK, 124 MOJO_RESULT_OK,
125 ReadDataRaw( 125 ReadDataRaw(
126 pipe.get(), data, &data_size, MOJO_READ_DATA_FLAG_ALL_OR_NONE)); 126 pipe.get(), data, &data_size, MOJO_READ_DATA_FLAG_ALL_OR_NONE));
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 run_loop.Run(); 347 run_loop.Run();
348 run_loop2.Run(); 348 run_loop2.Run();
349 349
350 EXPECT_EQ(std::string("object1"), name1); 350 EXPECT_EQ(std::string("object1"), name1);
351 EXPECT_EQ(std::string("object2"), name2); 351 EXPECT_EQ(std::string("object2"), name2);
352 } 352 }
353 353
354 } // namespace 354 } // namespace
355 } // namespace test 355 } // namespace test
356 } // namespace mojo 356 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/c/system/types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698