OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/nacl/nacl_ipc_adapter.h" | 5 #include "chrome/nacl/nacl_ipc_adapter.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 NaClIPCAdapterTest() {} | 24 NaClIPCAdapterTest() {} |
25 | 25 |
26 // testing::Test implementation. | 26 // testing::Test implementation. |
27 virtual void SetUp() OVERRIDE { | 27 virtual void SetUp() OVERRIDE { |
28 sink_ = new IPC::TestSink; | 28 sink_ = new IPC::TestSink; |
29 | 29 |
30 // Takes ownership of the sink_ pointer. Note we provide the current message | 30 // Takes ownership of the sink_ pointer. Note we provide the current message |
31 // loop instead of using a real IO thread. This should work OK since we do | 31 // loop instead of using a real IO thread. This should work OK since we do |
32 // not need real IPC for the tests. | 32 // not need real IPC for the tests. |
33 adapter_ = new NaClIPCAdapter(scoped_ptr<IPC::Channel>(sink_), | 33 adapter_ = new NaClIPCAdapter(scoped_ptr<IPC::Channel>(sink_), |
34 base::MessageLoopProxy::current()); | 34 base::MessageLoopProxy::current().get()); |
35 } | 35 } |
36 virtual void TearDown() OVERRIDE { | 36 virtual void TearDown() OVERRIDE { |
37 sink_ = NULL; // This pointer is actually owned by the IPCAdapter. | 37 sink_ = NULL; // This pointer is actually owned by the IPCAdapter. |
38 adapter_ = NULL; | 38 adapter_ = NULL; |
39 // The adapter destructor has to post a task to destroy the Channel on the | 39 // The adapter destructor has to post a task to destroy the Channel on the |
40 // IO thread. For the purposes of the test, we just need to make sure that | 40 // IO thread. For the purposes of the test, we just need to make sure that |
41 // task gets run, or it will appear as a leak. | 41 // task gets run, or it will appear as a leak. |
42 message_loop_.RunUntilIdle(); | 42 message_loop_.RunUntilIdle(); |
43 } | 43 } |
44 | 44 |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // back NACL_ABI_O_READONLY | 335 // back NACL_ABI_O_READONLY |
336 EXPECT_EQ(NACL_ABI_O_RDONLY, | 336 EXPECT_EQ(NACL_ABI_O_RDONLY, |
337 TranslatePepperFileReadWriteOpenFlagsForTesting(PP_FILEOPENFLAG_CREATE)); | 337 TranslatePepperFileReadWriteOpenFlagsForTesting(PP_FILEOPENFLAG_CREATE)); |
338 EXPECT_EQ(NACL_ABI_O_RDONLY, | 338 EXPECT_EQ(NACL_ABI_O_RDONLY, |
339 TranslatePepperFileReadWriteOpenFlagsForTesting( | 339 TranslatePepperFileReadWriteOpenFlagsForTesting( |
340 PP_FILEOPENFLAG_TRUNCATE)); | 340 PP_FILEOPENFLAG_TRUNCATE)); |
341 EXPECT_EQ(NACL_ABI_O_RDONLY, | 341 EXPECT_EQ(NACL_ABI_O_RDONLY, |
342 TranslatePepperFileReadWriteOpenFlagsForTesting( | 342 TranslatePepperFileReadWriteOpenFlagsForTesting( |
343 PP_FILEOPENFLAG_EXCLUSIVE)); | 343 PP_FILEOPENFLAG_EXCLUSIVE)); |
344 } | 344 } |
OLD | NEW |