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

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

Issue 140503005: Mojo: foo_[0-9] -> foo[0-9]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/system/core_impl.cc ('k') | mojo/system/message_pipe.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 #include "mojo/system/core_impl.h" 5 #include "mojo/system/core_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 MOJO_WRITE_MESSAGE_FLAG_NONE)); 244 MOJO_WRITE_MESSAGE_FLAG_NONE));
245 EXPECT_EQ(0u, info.GetWriteMessageCallCount()); 245 EXPECT_EQ(0u, info.GetWriteMessageCallCount());
246 246
247 // Can't send a handle over itself. 247 // Can't send a handle over itself.
248 handles[0] = h; 248 handles[0] = h;
249 EXPECT_EQ(MOJO_RESULT_BUSY, 249 EXPECT_EQ(MOJO_RESULT_BUSY,
250 core()->WriteMessage(h, NULL, 0, handles, 1, 250 core()->WriteMessage(h, NULL, 0, handles, 1,
251 MOJO_WRITE_MESSAGE_FLAG_NONE)); 251 MOJO_WRITE_MESSAGE_FLAG_NONE));
252 EXPECT_EQ(0u, info.GetWriteMessageCallCount()); 252 EXPECT_EQ(0u, info.GetWriteMessageCallCount());
253 253
254 MockHandleInfo info_2; 254 MockHandleInfo info2;
255 MojoHandle h_2 = CreateMockHandle(&info_2); 255 MojoHandle h2 = CreateMockHandle(&info2);
256 256
257 // This is "okay", but |MockDispatcher| doesn't implement it. 257 // This is "okay", but |MockDispatcher| doesn't implement it.
258 handles[0] = h_2; 258 handles[0] = h2;
259 EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED, 259 EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
260 core()->WriteMessage(h, NULL, 0, handles, 1, 260 core()->WriteMessage(h, NULL, 0, handles, 1,
261 MOJO_WRITE_MESSAGE_FLAG_NONE)); 261 MOJO_WRITE_MESSAGE_FLAG_NONE));
262 EXPECT_EQ(1u, info.GetWriteMessageCallCount()); 262 EXPECT_EQ(1u, info.GetWriteMessageCallCount());
263 263
264 // One of the |handles| is still invalid. 264 // One of the |handles| is still invalid.
265 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, 265 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
266 core()->WriteMessage(h, NULL, 0, handles, 2, 266 core()->WriteMessage(h, NULL, 0, handles, 2,
267 MOJO_WRITE_MESSAGE_FLAG_NONE)); 267 MOJO_WRITE_MESSAGE_FLAG_NONE));
268 EXPECT_EQ(1u, info.GetWriteMessageCallCount()); 268 EXPECT_EQ(1u, info.GetWriteMessageCallCount());
269 269
270 // One of the |handles| is the same as |handle|. 270 // One of the |handles| is the same as |handle|.
271 handles[1] = h; 271 handles[1] = h;
272 EXPECT_EQ(MOJO_RESULT_BUSY, 272 EXPECT_EQ(MOJO_RESULT_BUSY,
273 core()->WriteMessage(h, NULL, 0, handles, 2, 273 core()->WriteMessage(h, NULL, 0, handles, 2,
274 MOJO_WRITE_MESSAGE_FLAG_NONE)); 274 MOJO_WRITE_MESSAGE_FLAG_NONE));
275 EXPECT_EQ(1u, info.GetWriteMessageCallCount()); 275 EXPECT_EQ(1u, info.GetWriteMessageCallCount());
276 276
277 // Can't send a handle twice in the same message. 277 // Can't send a handle twice in the same message.
278 handles[1] = h_2; 278 handles[1] = h2;
279 EXPECT_EQ(MOJO_RESULT_BUSY, 279 EXPECT_EQ(MOJO_RESULT_BUSY,
280 core()->WriteMessage(h, NULL, 0, handles, 2, 280 core()->WriteMessage(h, NULL, 0, handles, 2,
281 MOJO_WRITE_MESSAGE_FLAG_NONE)); 281 MOJO_WRITE_MESSAGE_FLAG_NONE));
282 EXPECT_EQ(1u, info.GetWriteMessageCallCount()); 282 EXPECT_EQ(1u, info.GetWriteMessageCallCount());
283 283
284 // Note: Since we never successfully sent anything with it, |h_2| should 284 // Note: Since we never successfully sent anything with it, |h2| should
285 // still be valid. 285 // still be valid.
286 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_2)); 286 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h2));
287 287
288 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h)); 288 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h));
289 } 289 }
290 290
291 // |ReadMessage()|: 291 // |ReadMessage()|:
292 // Only check arguments checked by |CoreImpl|, namely |handle|, |handles|, and 292 // Only check arguments checked by |CoreImpl|, namely |handle|, |handles|, and
293 // |num_handles|. 293 // |num_handles|.
294 { 294 {
295 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, 295 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
296 core()->ReadMessage(MOJO_HANDLE_INVALID, NULL, NULL, NULL, NULL, 296 core()->ReadMessage(MOJO_HANDLE_INVALID, NULL, NULL, NULL, NULL,
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 772
773 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_passing[0])); 773 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_passing[0]));
774 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_passing[1])); 774 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_passing[1]));
775 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ph_received)); 775 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ph_received));
776 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ch_received)); 776 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ch_received));
777 } 777 }
778 778
779 } // namespace 779 } // namespace
780 } // namespace system 780 } // namespace system
781 } // namespace mojo 781 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/core_impl.cc ('k') | mojo/system/message_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698