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

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

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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/edk/system/message_pipe.h" 5 //#include "mojo/edk/system/message_pipe.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "mojo/edk/system/waiter.h" 8 #include "mojo/edk/system/waiter.h"
9 #include "mojo/edk/system/waiter_test_utils.h" 9 #include "mojo/edk/system/waiter_test_utils.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace system { 13 namespace system {
14 namespace { 14 namespace {
15 15
16 static const char kHelloWorld[] = "hello world";
17 /* jam embedder_unittest has similar.. look at Basic
18 TEST(MessagePipeTest, WriteData) {
19 MojoHandle pipe1, pipe2;
20 ASSERT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &pipe1, &pipe2));
21 ASSERT_EQ(MOJO_RESULT_OK,
22 MojoWriteMessage(pipe1, kHelloWorld, sizeof(kHelloWorld), nullptr,
23 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
24 }
25 */
26 /*
16 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE | 27 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE |
17 MOJO_HANDLE_SIGNAL_WRITABLE | 28 MOJO_HANDLE_SIGNAL_WRITABLE |
18 MOJO_HANDLE_SIGNAL_PEER_CLOSED; 29 MOJO_HANDLE_SIGNAL_PEER_CLOSED;
19 30
20 // Tests: 31 // Tests:
21 // - only default flags 32 // - only default flags
22 // - reading messages from a port 33 // - reading messages from a port
23 // - when there are no/one/two messages available for that port 34 // - when there are no/one/two messages available for that port
24 // - with buffer size 0 (and null buffer) -- should get size 35 // - with buffer size 0 (and null buffer) -- should get size
25 // - with too-small buffer -- should get size 36 // - with too-small buffer -- should get size
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 mp->RemoveAwakable(1, thread.waiter(), &hss); 570 mp->RemoveAwakable(1, thread.waiter(), &hss);
560 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); 571 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
561 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); 572 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
562 573
563 mp->CancelAllAwakables(1); 574 mp->CancelAllAwakables(1);
564 mp->Close(1); 575 mp->Close(1);
565 } // Joins |thread|. 576 } // Joins |thread|.
566 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); 577 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
567 EXPECT_EQ(4u, context); 578 EXPECT_EQ(4u, context);
568 } 579 }
569 580 */
570 } // namespace 581 } // namespace
571 } // namespace system 582 } // namespace system
572 } // namespace mojo 583 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698