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

Side by Side Diff: components/nacl/loader/nacl_ipc_adapter_unittest.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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
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 "components/nacl/loader/nacl_ipc_adapter.h" 5 #include "components/nacl/loader/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/message_loop.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/threading/platform_thread.h" 11 #include "base/threading/platform_thread.h"
13 #include "base/threading/simple_thread.h" 12 #include "base/threading/simple_thread.h"
14 #include "ipc/ipc_test_sink.h" 13 #include "ipc/ipc_test_sink.h"
15 #include "native_client/src/public/nacl_desc_custom.h" 14 #include "native_client/src/public/nacl_desc_custom.h"
16 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" 15 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
17 #include "ppapi/c/ppb_file_io.h" 16 #include "ppapi/c/ppb_file_io.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 namespace { 19 namespace {
21 20
22 class NaClIPCAdapterTest : public testing::Test { 21 class NaClIPCAdapterTest : public testing::Test {
23 public: 22 public:
24 NaClIPCAdapterTest() {} 23 NaClIPCAdapterTest() {}
25 24
26 // testing::Test implementation. 25 // testing::Test implementation.
27 void SetUp() override { 26 void SetUp() override {
28 sink_ = new IPC::TestSink; 27 sink_ = new IPC::TestSink;
29 28
30 // Takes ownership of the sink_ pointer. Note we provide the current message 29 // 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 30 // loop instead of using a real IO thread. This should work OK since we do
32 // not need real IPC for the tests. 31 // not need real IPC for the tests.
33 adapter_ = new NaClIPCAdapter(scoped_ptr<IPC::Channel>(sink_), 32 adapter_ = new NaClIPCAdapter(scoped_ptr<IPC::Channel>(sink_),
34 base::MessageLoopProxy::current().get()); 33 base::ThreadTaskRunnerHandle::Get().get());
35 } 34 }
36 void TearDown() override { 35 void TearDown() override {
37 sink_ = NULL; // This pointer is actually owned by the IPCAdapter. 36 sink_ = NULL; // This pointer is actually owned by the IPCAdapter.
38 adapter_ = NULL; 37 adapter_ = NULL;
39 // The adapter destructor has to post a task to destroy the Channel on the 38 // 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 39 // 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. 40 // task gets run, or it will appear as a leak.
42 message_loop_.RunUntilIdle(); 41 message_loop_.RunUntilIdle();
43 } 42 }
44 43
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 EXPECT_EQ(NACL_ABI_O_RDONLY, 347 EXPECT_EQ(NACL_ABI_O_RDONLY,
349 TranslatePepperFileReadWriteOpenFlagsForTesting( 348 TranslatePepperFileReadWriteOpenFlagsForTesting(
350 PP_FILEOPENFLAG_CREATE)); 349 PP_FILEOPENFLAG_CREATE));
351 EXPECT_EQ(NACL_ABI_O_RDONLY, 350 EXPECT_EQ(NACL_ABI_O_RDONLY,
352 TranslatePepperFileReadWriteOpenFlagsForTesting( 351 TranslatePepperFileReadWriteOpenFlagsForTesting(
353 PP_FILEOPENFLAG_TRUNCATE)); 352 PP_FILEOPENFLAG_TRUNCATE));
354 EXPECT_EQ(NACL_ABI_O_RDONLY, 353 EXPECT_EQ(NACL_ABI_O_RDONLY,
355 TranslatePepperFileReadWriteOpenFlagsForTesting( 354 TranslatePepperFileReadWriteOpenFlagsForTesting(
356 PP_FILEOPENFLAG_EXCLUSIVE)); 355 PP_FILEOPENFLAG_EXCLUSIVE));
357 } 356 }
OLDNEW
« no previous file with comments | « components/nacl/common/nacl_debug_exception_handler_win.cc ('k') | components/nacl/loader/nacl_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698