OLD | NEW |
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 #include "sandbox/mac/xpc_message_server.h" | 5 #include "sandbox/mac/xpc_message_server.h" |
6 | 6 |
7 #include <Block.h> | 7 #include <Block.h> |
8 #include <mach/mach.h> | 8 #include <mach/mach.h> |
9 #include <servers/bootstrap.h> | 9 #include <servers/bootstrap.h> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 class XPCMessageServerTest : public testing::Test { | 23 class XPCMessageServerTest : public testing::Test { |
24 public: | 24 public: |
25 virtual void SetUp() OVERRIDE { | 25 virtual void SetUp() OVERRIDE { |
26 if (!RunXPCTest()) | 26 if (!RunXPCTest()) |
27 return; | 27 return; |
28 ASSERT_TRUE(InitializeXPC()); | 28 ASSERT_TRUE(InitializeXPC()); |
29 } | 29 } |
30 | 30 |
31 bool RunXPCTest() { | 31 bool RunXPCTest() { |
32 return base::mac::IsOSLionOrLater(); | 32 return base::mac::IsOSMountainLionOrLater(); |
33 } | 33 } |
34 }; | 34 }; |
35 | 35 |
36 // A MessageDemuxer that manages a test server and executes a block for every | 36 // A MessageDemuxer that manages a test server and executes a block for every |
37 // message. | 37 // message. |
38 class BlockDemuxer : public MessageDemuxer { | 38 class BlockDemuxer : public MessageDemuxer { |
39 public: | 39 public: |
40 BlockDemuxer() | 40 BlockDemuxer() |
41 : demux_block_(NULL), | 41 : demux_block_(NULL), |
42 server_(this, MACH_PORT_NULL), | 42 server_(this, MACH_PORT_NULL), |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 ASSERT_EQ(0, xpc_pipe_routine(first.pipe(), request, &reply)); | 210 ASSERT_EQ(0, xpc_pipe_routine(first.pipe(), request, &reply)); |
211 | 211 |
212 EXPECT_EQ(1, xpc_dictionary_get_int64(reply, "seen_by_first")); | 212 EXPECT_EQ(1, xpc_dictionary_get_int64(reply, "seen_by_first")); |
213 EXPECT_EQ(2, xpc_dictionary_get_int64(reply, "seen_by_second")); | 213 EXPECT_EQ(2, xpc_dictionary_get_int64(reply, "seen_by_second")); |
214 | 214 |
215 xpc_release(request); | 215 xpc_release(request); |
216 xpc_release(reply); | 216 xpc_release(reply); |
217 } | 217 } |
218 | 218 |
219 } // namespace sandbox | 219 } // namespace sandbox |
OLD | NEW |