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

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

Issue 1441853003: Make the new Mojo EDK work on XP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixes Created 5 years, 1 month 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
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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "mojo/edk/embedder/embedder_internal.h" 12 #include "mojo/edk/embedder/embedder_internal.h"
13 #include "mojo/edk/system/awakable.h" 13 #include "mojo/edk/system/awakable.h"
14 #include "mojo/edk/system/core_test_base.h" 14 #include "mojo/edk/system/core_test_base.h"
15 #include "mojo/edk/system/test_utils.h" 15 #include "mojo/edk/system/test_utils.h"
16 #include "mojo/public/cpp/system/macros.h" 16 #include "mojo/public/cpp/system/macros.h"
17 17
18 #if defined(OS_WIN)
19 #include "base/win/windows_version.h"
20 #endif
21
18 namespace mojo { 22 namespace mojo {
19 namespace edk { 23 namespace edk {
20 namespace { 24 namespace {
21 25
22 const MojoHandleSignalsState kEmptyMojoHandleSignalsState = {0u, 0u}; 26 const MojoHandleSignalsState kEmptyMojoHandleSignalsState = {0u, 0u};
23 const MojoHandleSignalsState kFullMojoHandleSignalsState = {~0u, ~0u}; 27 const MojoHandleSignalsState kFullMojoHandleSignalsState = {~0u, ~0u};
24 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE | 28 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE |
25 MOJO_HANDLE_SIGNAL_WRITABLE | 29 MOJO_HANDLE_SIGNAL_WRITABLE |
26 MOJO_HANDLE_SIGNAL_PEER_CLOSED; 30 MOJO_HANDLE_SIGNAL_PEER_CLOSED;
27 31
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 ASSERT_EQ(kHelloSize, num_bytes); 711 ASSERT_EQ(kHelloSize, num_bytes);
708 ASSERT_STREQ(kHello, buffer); 712 ASSERT_STREQ(kHello, buffer);
709 ASSERT_EQ(0u, num_handles); 713 ASSERT_EQ(0u, num_handles);
710 714
711 // Make sure that you can't pass either of the message pipe's handles over 715 // Make sure that you can't pass either of the message pipe's handles over
712 // itself. 716 // itself.
713 ASSERT_EQ(MOJO_RESULT_BUSY, 717 ASSERT_EQ(MOJO_RESULT_BUSY,
714 core()->WriteMessage(h_passing[0], kHello, kHelloSize, 718 core()->WriteMessage(h_passing[0], kHello, kHelloSize,
715 &h_passing[0], 1, 719 &h_passing[0], 1,
716 MOJO_WRITE_MESSAGE_FLAG_NONE)); 720 MOJO_WRITE_MESSAGE_FLAG_NONE));
721 #if defined(OS_WIN)
yzshen1 2015/11/13 18:27:07 Please use #if #endif around complete statements:
yzshen1 2015/11/13 18:31:06 Maybe: bool write_message = true; #if defined(OS_
jam 2015/11/13 18:35:46 yeah i considered the alternatives, but thought i'
722 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
723 #endif
717 ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT, 724 ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
718 core()->WriteMessage(h_passing[0], kHello, kHelloSize, 725 core()->WriteMessage(h_passing[0], kHello, kHelloSize,
719 &h_passing[1], 1, 726 &h_passing[1], 1,
720 MOJO_WRITE_MESSAGE_FLAG_NONE)); 727 MOJO_WRITE_MESSAGE_FLAG_NONE));
728 #if defined(OS_WIN)
729 }
730 #endif
721 731
722 MojoHandle h_passed[2]; 732 MojoHandle h_passed[2];
723 ASSERT_EQ(MOJO_RESULT_OK, 733 ASSERT_EQ(MOJO_RESULT_OK,
724 core()->CreateMessagePipe(nullptr, &h_passed[0], &h_passed[1])); 734 core()->CreateMessagePipe(nullptr, &h_passed[0], &h_passed[1]));
725 735
726 // Make sure that |h_passed[]| work properly. 736 // Make sure that |h_passed[]| work properly.
727 ASSERT_EQ(MOJO_RESULT_OK, 737 ASSERT_EQ(MOJO_RESULT_OK,
728 core()->WriteMessage(h_passed[0], kHello, kHelloSize, nullptr, 0, 738 core()->WriteMessage(h_passed[0], kHello, kHelloSize, nullptr, 0,
729 MOJO_WRITE_MESSAGE_FLAG_NONE)); 739 MOJO_WRITE_MESSAGE_FLAG_NONE));
730 hss = kEmptyMojoHandleSignalsState; 740 hss = kEmptyMojoHandleSignalsState;
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 ASSERT_EQ(MOJO_RESULT_BUSY, waiter.result); 1266 ASSERT_EQ(MOJO_RESULT_BUSY, waiter.result);
1257 1267
1258 ASSERT_EQ(MOJO_RESULT_OK, core()->Close(h)); 1268 ASSERT_EQ(MOJO_RESULT_OK, core()->Close(h));
1259 } 1269 }
1260 1270
1261 // TODO(vtl): Test |DuplicateBufferHandle()| and |MapBuffer()|. 1271 // TODO(vtl): Test |DuplicateBufferHandle()| and |MapBuffer()|.
1262 1272
1263 } // namespace 1273 } // namespace
1264 } // namespace edk 1274 } // namespace edk
1265 } // namespace mojo 1275 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc ('k') | mojo/edk/system/raw_channel_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698