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

Side by Side Diff: mojo/public/cpp/system/tests/core_unittest.cc

Issue 2109843002: Add C++ wrappers for the wait set functions. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 5 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/public/cpp/system/wait_set.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This file tests the C++ Mojo system core wrappers. 5 // This file tests the C++ Mojo system core wrappers.
6 // TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets 6 // TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets
7 // compiled into a different binary from the C API tests. 7 // compiled into a different binary from the C API tests.
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
11 #include <map> 11 #include <map>
12 12
13 #include "mojo/public/cpp/system/buffer.h" 13 #include "mojo/public/cpp/system/buffer.h"
14 #include "mojo/public/cpp/system/data_pipe.h" 14 #include "mojo/public/cpp/system/data_pipe.h"
15 #include "mojo/public/cpp/system/handle.h" 15 #include "mojo/public/cpp/system/handle.h"
16 #include "mojo/public/cpp/system/macros.h" 16 #include "mojo/public/cpp/system/macros.h"
17 #include "mojo/public/cpp/system/message_pipe.h" 17 #include "mojo/public/cpp/system/message_pipe.h"
18 #include "mojo/public/cpp/system/time.h" 18 #include "mojo/public/cpp/system/time.h"
19 #include "mojo/public/cpp/system/wait.h" 19 #include "mojo/public/cpp/system/wait.h"
20 #include "mojo/public/cpp/system/wait_set.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 namespace mojo { 23 namespace mojo {
23 namespace { 24 namespace {
24 25
25 TEST(CoreCppTest, GetTimeTicksNow) { 26 TEST(CoreCppTest, GetTimeTicksNow) {
26 const MojoTimeTicks start = GetTimeTicksNow(); 27 const MojoTimeTicks start = GetTimeTicksNow();
27 EXPECT_NE(static_cast<MojoTimeTicks>(0), start) 28 EXPECT_NE(static_cast<MojoTimeTicks>(0), start)
28 << "GetTimeTicksNow should return nonzero value"; 29 << "GetTimeTicksNow should return nonzero value";
29 } 30 }
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 // Close the producer. 644 // Close the producer.
644 ph.reset(); 645 ph.reset();
645 646
646 // Waiting for "read" should now fail. 647 // Waiting for "read" should now fail.
647 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, 648 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
648 Wait(ch.get(), MOJO_HANDLE_SIGNAL_READ_THRESHOLD, 1000, nullptr)); 649 Wait(ch.get(), MOJO_HANDLE_SIGNAL_READ_THRESHOLD, 1000, nullptr));
649 } 650 }
650 651
651 } // namespace 652 } // namespace
652 } // namespace mojo 653 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/system/wait_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698