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

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

Issue 1865663002: Let MojoSetDataPipeConsumerOptions() take null options. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | mojo/edk/system/data_pipe_consumer_dispatcher.cc » ('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/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
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
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
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/data_pipe_consumer_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698