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

Side by Side Diff: mojo/edk/system/message_pipe_dispatcher_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: move to mojo::edk namespace in preparation for runtim flag Created 5 years, 3 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 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a 5 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a
6 // heavily-loaded system). Sorry. |test::EpsilonDeadline()| may be increased to 6 // heavily-loaded system). Sorry. |test::EpsilonDeadline()| may be increased to
7 // increase tolerance and reduce observed flakiness (though doing so reduces the 7 // increase tolerance and reduce observed flakiness (though doing so reduces the
8 // meaningfulness of the test). 8 // meaningfulness of the test).
9 9
10 #include "mojo/edk/system/message_pipe_dispatcher.h" 10 #include "mojo/edk/system/message_pipe_dispatcher.h"
11 11
12 #include <string.h> 12 #include <string.h>
13 13
14 #include <limits> 14 #include <limits>
15 15
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
18 #include "base/rand_util.h" 18 #include "base/rand_util.h"
19 #include "base/threading/simple_thread.h" 19 #include "base/threading/simple_thread.h"
20 #include "mojo/edk/system/message_pipe.h" 20 #include "mojo/edk/system/message_pipe.h"
21 #include "mojo/edk/system/test_utils.h" 21 #include "mojo/edk/system/test_utils.h"
22 #include "mojo/edk/system/waiter.h" 22 #include "mojo/edk/system/waiter.h"
23 #include "mojo/edk/system/waiter_test_utils.h" 23 #include "mojo/edk/system/waiter_test_utils.h"
24 #include "mojo/public/cpp/system/macros.h" 24 #include "mojo/public/cpp/system/macros.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 26
27 namespace mojo { 27 namespace mojo {
28 namespace system { 28 namespace edk {
29 namespace { 29 namespace {
30 30
31 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE | 31 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE |
32 MOJO_HANDLE_SIGNAL_WRITABLE | 32 MOJO_HANDLE_SIGNAL_WRITABLE |
33 MOJO_HANDLE_SIGNAL_PEER_CLOSED; 33 MOJO_HANDLE_SIGNAL_PEER_CLOSED;
34 34
35 TEST(MessagePipeDispatcherTest, Basic) { 35 TEST(MessagePipeDispatcherTest, Basic) {
36 test::Stopwatch stopwatch; 36 test::Stopwatch stopwatch;
37 int32_t buffer[1]; 37 int32_t buffer[1];
38 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); 38 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 EXPECT_GE(bytes_read[i], messages_read[i]) << "reader: " << i; 679 EXPECT_GE(bytes_read[i], messages_read[i]) << "reader: " << i;
680 } 680 }
681 EXPECT_EQ(total_messages_written, total_messages_read); 681 EXPECT_EQ(total_messages_written, total_messages_read);
682 EXPECT_EQ(total_bytes_written, total_bytes_read); 682 EXPECT_EQ(total_bytes_written, total_bytes_read);
683 683
684 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close()); 684 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close());
685 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close()); 685 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close());
686 } 686 }
687 687
688 } // namespace 688 } // namespace
689 } // namespace system 689 } // namespace edk
690 } // namespace mojo 690 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698