OLD | NEW |
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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "mojo/edk/embedder/platform_channel_pair.h" | 12 #include "mojo/edk/embedder/platform_channel_pair.h" |
13 #include "mojo/edk/embedder/simple_platform_support.h" | 13 #include "mojo/edk/embedder/simple_platform_support.h" |
14 #include "mojo/edk/system/test_utils.h" | 14 #include "mojo/edk/system/test_utils.h" |
15 #include "mojo/edk/system/waiter.h" | 15 #include "mojo/edk/system/waiter.h" |
16 #include "mojo/public/c/system/data_pipe.h" | 16 #include "mojo/public/c/system/data_pipe.h" |
17 #include "mojo/public/c/system/functions.h" | 17 #include "mojo/public/c/system/functions.h" |
18 #include "mojo/public/cpp/system/macros.h" | 18 #include "mojo/public/cpp/system/macros.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 namespace mojo { | 21 namespace mojo { |
22 namespace edk { | 22 namespace edk { |
23 namespace { | 23 namespace { |
24 | 24 |
25 const MojoHandleSignals kSignalAll = MOJO_HANDLE_SIGNAL_READABLE | | |
26 MOJO_HANDLE_SIGNAL_WRITABLE | | |
27 MOJO_HANDLE_SIGNAL_PEER_CLOSED; | |
28 const uint32_t kSizeOfOptions = | 25 const uint32_t kSizeOfOptions = |
29 static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions)); | 26 static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions)); |
30 | 27 |
31 // In various places, we have to poll (since, e.g., we can't yet wait for a | 28 // In various places, we have to poll (since, e.g., we can't yet wait for a |
32 // certain amount of data to be available). This is the maximum number of | 29 // certain amount of data to be available). This is the maximum number of |
33 // iterations (separated by a short sleep). | 30 // iterations (separated by a short sleep). |
34 // TODO(vtl): Get rid of this. | 31 // TODO(vtl): Get rid of this. |
35 const size_t kMaxPoll = 100; | 32 const size_t kMaxPoll = 100; |
36 | 33 |
37 class DataPipeTest : public test::MojoSystemTest { | 34 class DataPipeTest : public test::MojoSystemTest { |
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 | 1562 |
1566 // Still one element available. | 1563 // Still one element available. |
1567 num_bytes = 0u; | 1564 num_bytes = 0u; |
1568 ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes)); | 1565 ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes)); |
1569 ASSERT_EQ(1u * sizeof(int32_t), num_bytes); | 1566 ASSERT_EQ(1u * sizeof(int32_t), num_bytes); |
1570 } | 1567 } |
1571 | 1568 |
1572 } // namespace | 1569 } // namespace |
1573 } // namespace edk | 1570 } // namespace edk |
1574 } // namespace mojo | 1571 } // namespace mojo |
OLD | NEW |