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

Unified Diff: mojo/public/c/system/tests/core_unittest.cc

Issue 1876353006: Add Mojo{Set,Get}DataPipeProducerOptions() to the NaCl system thunks. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: gah 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/nacl/sfi/nacl_bindings_generator/interface.py ('k') | mojo/public/platform/nacl/libmojo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/c/system/tests/core_unittest.cc
diff --git a/mojo/public/c/system/tests/core_unittest.cc b/mojo/public/c/system/tests/core_unittest.cc
index 5eeec823cbd75a178995df9cc6e7c9ca460d7bc3..b8667fd80faa6047e5aa2d30bc297843e3e41cac 100644
--- a/mojo/public/c/system/tests/core_unittest.cc
+++ b/mojo/public/c/system/tests/core_unittest.cc
@@ -63,6 +63,14 @@ TEST(CoreTest, InvalidHandle) {
nullptr, MOJO_READ_MESSAGE_FLAG_NONE));
// Data pipe:
+ MojoDataPipeProducerOptions dpp_options = {
+ sizeof(MojoDataPipeProducerOptions), 0u};
+ EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+ MojoSetDataPipeProducerOptions(MOJO_HANDLE_INVALID, &dpp_options));
+ EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+ MojoGetDataPipeProducerOptions(
+ MOJO_HANDLE_INVALID, &dpp_options,
+ static_cast<uint32_t>(sizeof(dpp_options))));
buffer_size = static_cast<uint32_t>(sizeof(buffer));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
MojoWriteData(MOJO_HANDLE_INVALID, buffer, &buffer_size,
@@ -317,8 +325,6 @@ TEST(CoreTest, MAYBE_BasicDataPipe) {
// the producer never-writable?
}
-// TODO(vtl): Enable once I've added support for NaCl.
-#ifndef __native_client__
TEST(CoreTest, DataPipeWriteThreshold) {
const MojoCreateDataPipeOptions options = {
static_cast<uint32_t>(
@@ -377,15 +383,12 @@ TEST(CoreTest, DataPipeWriteThreshold) {
EXPECT_EQ(MOJO_RESULT_OK,
MojoWait(hp, MOJO_HANDLE_SIGNAL_WRITE_THRESHOLD, 0, nullptr));
- // Do a two-phase write of another element.
- void* write_pointer = nullptr;
- num_bytes = 0u;
- EXPECT_EQ(MOJO_RESULT_OK, MojoBeginWriteData(hp, &write_pointer, &num_bytes,
- MOJO_WRITE_DATA_FLAG_NONE));
- ASSERT_TRUE(write_pointer);
- ASSERT_EQ(2u, num_bytes);
- *static_cast<uint16_t*>(write_pointer) = 6789u;
- EXPECT_EQ(MOJO_RESULT_OK, MojoEndWriteData(hp, 2u));
+ // Write another element.
+ static const uint16_t kAnotherTestElem = 12345u;
+ num_bytes = 2u;
+ EXPECT_EQ(MOJO_RESULT_OK, MojoWriteData(hp, &kAnotherTestElem, &num_bytes,
+ MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(2u, num_bytes);
// Should no longer have the write threshold signal.
state = MojoHandleSignalsState();
@@ -450,7 +453,6 @@ TEST(CoreTest, DataPipeWriteThreshold) {
EXPECT_EQ(MOJO_RESULT_OK, MojoClose(hp));
}
-#endif
TEST(CoreTest, DataPipeReadThreshold) {
MojoHandle hp = MOJO_HANDLE_INVALID;
« no previous file with comments | « mojo/nacl/sfi/nacl_bindings_generator/interface.py ('k') | mojo/public/platform/nacl/libmojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698