| OLD | NEW |
| 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/core.h" | 5 #include "mojo/edk/system/core.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 copts.struct_size = kCoptsSize; | 1243 copts.struct_size = kCoptsSize; |
| 1244 copts.read_threshold_num_bytes = 16; | 1244 copts.read_threshold_num_bytes = 16; |
| 1245 EXPECT_EQ(MOJO_RESULT_OK, | 1245 EXPECT_EQ(MOJO_RESULT_OK, |
| 1246 core()->SetDataPipeConsumerOptions(ch, MakeUserPointer(&copts))); | 1246 core()->SetDataPipeConsumerOptions(ch, MakeUserPointer(&copts))); |
| 1247 copts = MojoDataPipeConsumerOptions(); | 1247 copts = MojoDataPipeConsumerOptions(); |
| 1248 EXPECT_EQ(MOJO_RESULT_OK, core()->GetDataPipeConsumerOptions( | 1248 EXPECT_EQ(MOJO_RESULT_OK, core()->GetDataPipeConsumerOptions( |
| 1249 ch, MakeUserPointer(&copts), kCoptsSize)); | 1249 ch, MakeUserPointer(&copts), kCoptsSize)); |
| 1250 EXPECT_EQ(kCoptsSize, copts.struct_size); | 1250 EXPECT_EQ(kCoptsSize, copts.struct_size); |
| 1251 EXPECT_EQ(16u, copts.read_threshold_num_bytes); | 1251 EXPECT_EQ(16u, copts.read_threshold_num_bytes); |
| 1252 | 1252 |
| 1253 // Default read threshold. | 1253 // Can also set to default by passing null. |
| 1254 copts.struct_size = kCoptsSize; | |
| 1255 copts.read_threshold_num_bytes = 0; | |
| 1256 EXPECT_EQ(MOJO_RESULT_OK, | 1254 EXPECT_EQ(MOJO_RESULT_OK, |
| 1257 core()->SetDataPipeConsumerOptions(ch, MakeUserPointer(&copts))); | 1255 core()->SetDataPipeConsumerOptions(ch, NullUserPointer())); |
| 1258 copts = MojoDataPipeConsumerOptions(); | 1256 copts = MojoDataPipeConsumerOptions(); |
| 1259 EXPECT_EQ(MOJO_RESULT_OK, core()->GetDataPipeConsumerOptions( | 1257 EXPECT_EQ(MOJO_RESULT_OK, core()->GetDataPipeConsumerOptions( |
| 1260 ch, MakeUserPointer(&copts), kCoptsSize)); | 1258 ch, MakeUserPointer(&copts), kCoptsSize)); |
| 1261 EXPECT_EQ(kCoptsSize, copts.struct_size); | 1259 EXPECT_EQ(kCoptsSize, copts.struct_size); |
| 1262 // Note: Should be reported as 0 ("default"), even if it means the element | 1260 // Note: Should be reported as 0 ("default"), even if it means the element |
| 1263 // struct_size. | 1261 // struct_size. |
| 1264 EXPECT_EQ(0u, copts.read_threshold_num_bytes); | 1262 EXPECT_EQ(0u, copts.read_threshold_num_bytes); |
| 1265 | 1263 |
| 1266 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ph)); | 1264 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ph)); |
| 1267 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ch)); | 1265 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ch)); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 EXPECT_EQ(MOJO_RESULT_BUSY, waiter.result); | 1543 EXPECT_EQ(MOJO_RESULT_BUSY, waiter.result); |
| 1546 | 1544 |
| 1547 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h)); | 1545 EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h)); |
| 1548 } | 1546 } |
| 1549 | 1547 |
| 1550 // TODO(vtl): Test |DuplicateBufferHandle()| and |MapBuffer()|. | 1548 // TODO(vtl): Test |DuplicateBufferHandle()| and |MapBuffer()|. |
| 1551 | 1549 |
| 1552 } // namespace | 1550 } // namespace |
| 1553 } // namespace system | 1551 } // namespace system |
| 1554 } // namespace mojo | 1552 } // namespace mojo |
| OLD | NEW |