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

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

Issue 1687093002: [mojo-edk] Bring most tests back up on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/multiprocess_message_pipe_unittest.cc ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <string.h> 5 #include <string.h>
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // Reads a single message with a shared buffer handle, maps the buffer, copies 55 // Reads a single message with a shared buffer handle, maps the buffer, copies
56 // the message contents into it, then exits. 56 // the message contents into it, then exits.
57 DEFINE_TEST_CLIENT_TEST_WITH_PIPE(CopyToBufferClient, SharedBufferTest, h) { 57 DEFINE_TEST_CLIENT_TEST_WITH_PIPE(CopyToBufferClient, SharedBufferTest, h) {
58 MojoHandle b; 58 MojoHandle b;
59 std::string message = ReadMessageWithHandles(h, &b, 1); 59 std::string message = ReadMessageWithHandles(h, &b, 1);
60 WriteToBuffer(b, 0, message); 60 WriteToBuffer(b, 0, message);
61 61
62 EXPECT_EQ("quit", ReadMessage(h)); 62 EXPECT_EQ("quit", ReadMessage(h));
63 } 63 }
64 64
65 TEST_F(SharedBufferTest, PassSharedBufferCrossProcess) { 65 #if defined(OS_ANDROID)
66 // Android multi-process tests are not executing the new process. This is flaky.
67 #define MAYBE_PassSharedBufferCrossProcess DISABLED_PassSharedBufferCrossProcess
68 #else
69 #define MAYBE_PassSharedBufferCrossProcess PassSharedBufferCrossProcess
70 #endif
71 TEST_F(SharedBufferTest, MAYBE_PassSharedBufferCrossProcess) {
66 const std::string message = "hello"; 72 const std::string message = "hello";
67 MojoHandle b = CreateBuffer(message.size()); 73 MojoHandle b = CreateBuffer(message.size());
68 74
69 RUN_CHILD_ON_PIPE(CopyToBufferClient, h) 75 RUN_CHILD_ON_PIPE(CopyToBufferClient, h)
70 MojoHandle dupe = DuplicateBuffer(b); 76 MojoHandle dupe = DuplicateBuffer(b);
71 WriteMessageWithHandles(h, message, &dupe, 1); 77 WriteMessageWithHandles(h, message, &dupe, 1);
72 WriteMessage(h, "quit"); 78 WriteMessage(h, "quit");
73 END_CHILD() 79 END_CHILD()
74 80
75 ExpectBufferContents(b, 0, message); 81 ExpectBufferContents(b, 0, message);
76 } 82 }
77 83
78 // Creates a new buffer, maps it, writes a message contents to it, unmaps it, 84 // Creates a new buffer, maps it, writes a message contents to it, unmaps it,
79 // and finally passes it back to the parent. 85 // and finally passes it back to the parent.
80 DEFINE_TEST_CLIENT_TEST_WITH_PIPE(CreateBufferClient, SharedBufferTest, h) { 86 DEFINE_TEST_CLIENT_TEST_WITH_PIPE(CreateBufferClient, SharedBufferTest, h) {
81 std::string message = ReadMessage(h); 87 std::string message = ReadMessage(h);
82 MojoHandle b = CreateBuffer(message.size()); 88 MojoHandle b = CreateBuffer(message.size());
83 WriteToBuffer(b, 0, message); 89 WriteToBuffer(b, 0, message);
84 WriteMessageWithHandles(h, "have a buffer", &b, 1); 90 WriteMessageWithHandles(h, "have a buffer", &b, 1);
85 91
86 EXPECT_EQ("quit", ReadMessage(h)); 92 EXPECT_EQ("quit", ReadMessage(h));
87 } 93 }
88 94
89 TEST_F(SharedBufferTest, PassSharedBufferFromChild) { 95 #if defined(OS_ANDROID)
96 // Android multi-process tests are not executing the new process. This is flaky.
97 #define MAYBE_PassSharedBufferFromChild DISABLED_PassSharedBufferFromChild
98 #else
99 #define MAYBE_PassSharedBufferFromChild PassSharedBufferFromChild
100 #endif
101 TEST_F(SharedBufferTest, MAYBE_PassSharedBufferFromChild) {
90 const std::string message = "hello"; 102 const std::string message = "hello";
91 MojoHandle b; 103 MojoHandle b;
92 RUN_CHILD_ON_PIPE(CreateBufferClient, h) 104 RUN_CHILD_ON_PIPE(CreateBufferClient, h)
93 WriteMessage(h, message); 105 WriteMessage(h, message);
94 ReadMessageWithHandles(h, &b, 1); 106 ReadMessageWithHandles(h, &b, 1);
95 WriteMessage(h, "quit"); 107 WriteMessage(h, "quit");
96 END_CHILD() 108 END_CHILD()
97 109
98 ExpectBufferContents(b, 0, message); 110 ExpectBufferContents(b, 0, message);
99 } 111 }
(...skipping 26 matching lines...) Expand all
126 MojoHandle b; 138 MojoHandle b;
127 ReadMessageWithHandles(other_child, &b, 1); 139 ReadMessageWithHandles(other_child, &b, 1);
128 140
129 // Write the message from the parent into the buffer and exit. 141 // Write the message from the parent into the buffer and exit.
130 WriteToBuffer(b, 0, message); 142 WriteToBuffer(b, 0, message);
131 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(b)); 143 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(b));
132 EXPECT_EQ("quit", ReadMessage(h)); 144 EXPECT_EQ("quit", ReadMessage(h));
133 WriteMessage(h, "ok"); 145 WriteMessage(h, "ok");
134 } 146 }
135 147
136 TEST_F(SharedBufferTest, PassSharedBufferFromChildToChild) { 148 #if defined(OS_ANDROID)
149 // Android multi-process tests are not executing the new process. This is flaky.
150 #define MAYBE_PassSharedBufferFromChildToChild \
151 DISABLED_PassSharedBufferFromChildToChild
152 #else
153 #define MAYBE_PassSharedBufferFromChildToChild PassSharedBufferFromChildToChild
154 #endif
155 TEST_F(SharedBufferTest, MAYBE_PassSharedBufferFromChildToChild) {
137 const std::string message = "hello"; 156 const std::string message = "hello";
138 MojoHandle p0, p1; 157 MojoHandle p0, p1;
139 CreateMessagePipe(&p0, &p1); 158 CreateMessagePipe(&p0, &p1);
140 159
141 MojoHandle b; 160 MojoHandle b;
142 RUN_CHILD_ON_PIPE(CreateAndPassBuffer, h0) 161 RUN_CHILD_ON_PIPE(CreateAndPassBuffer, h0)
143 RUN_CHILD_ON_PIPE(ReceiveAndEditBuffer, h1) 162 RUN_CHILD_ON_PIPE(ReceiveAndEditBuffer, h1)
144 // Send one end of the pipe to each child. The first child will create 163 // Send one end of the pipe to each child. The first child will create
145 // and pass a buffer to the second child and back to us. The second child 164 // and pass a buffer to the second child and back to us. The second child
146 // will write our message into the buffer. 165 // will write our message into the buffer.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 std::string message = ReadMessageWithHandles(parent, &pipe, 1); 209 std::string message = ReadMessageWithHandles(parent, &pipe, 1);
191 WriteMessageWithHandles(child, message, &pipe, 1); 210 WriteMessageWithHandles(child, message, &pipe, 1);
192 211
193 EXPECT_EQ("quit", ReadMessage(parent)); 212 EXPECT_EQ("quit", ReadMessage(parent));
194 WriteMessage(child, "quit"); 213 WriteMessage(child, "quit");
195 EXPECT_EQ("ok", ReadMessage(child)); 214 EXPECT_EQ("ok", ReadMessage(child));
196 WriteMessage(parent, "ok"); 215 WriteMessage(parent, "ok");
197 END_CHILD() 216 END_CHILD()
198 } 217 }
199 218
200 TEST_F(SharedBufferTest, PassHandleBetweenCousins) { 219 #if defined(OS_ANDROID)
220 // Android multi-process tests are not executing the new process. This is flaky.
221 #define MAYBE_PassHandleBetweenCousins DISABLED_PassHandleBetweenCousins
222 #else
223 #define MAYBE_PassHandleBetweenCousins PassHandleBetweenCousins
224 #endif
225 TEST_F(SharedBufferTest, MAYBE_PassHandleBetweenCousins) {
201 const std::string message = "hello"; 226 const std::string message = "hello";
202 MojoHandle p0, p1; 227 MojoHandle p0, p1;
203 CreateMessagePipe(&p0, &p1); 228 CreateMessagePipe(&p0, &p1);
204 229
205 // Spawn two children who will each spawn their own child. Make sure the 230 // Spawn two children who will each spawn their own child. Make sure the
206 // grandchildren (cousins to each other) can pass platform handles. 231 // grandchildren (cousins to each other) can pass platform handles.
207 MojoHandle b; 232 MojoHandle b;
208 RUN_CHILD_ON_PIPE(CreateAndPassBufferParent, child1) 233 RUN_CHILD_ON_PIPE(CreateAndPassBufferParent, child1)
209 RUN_CHILD_ON_PIPE(ReceiveAndEditBufferParent, child2) 234 RUN_CHILD_ON_PIPE(ReceiveAndEditBufferParent, child2)
210 MojoHandle pipe[2]; 235 MojoHandle pipe[2];
(...skipping 14 matching lines...) Expand all
225 250
226 // The second grandchild should have written this message. 251 // The second grandchild should have written this message.
227 ExpectBufferContents(b, 0, message); 252 ExpectBufferContents(b, 0, message);
228 } 253 }
229 254
230 #endif // !defined(OS_IOS) 255 #endif // !defined(OS_IOS)
231 256
232 } // namespace 257 } // namespace
233 } // namespace edk 258 } // namespace edk
234 } // namespace mojo 259 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/multiprocess_message_pipe_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698