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

Side by Side Diff: ipc/mojo/async_handle_waiter_unittest.cc

Issue 1127153003: ipc: 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, 7 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 | « ipc/ipc_test_base.cc ('k') | ipc/mojo/ipc_channel_mojo.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ipc/mojo/async_handle_waiter.h" 5 #include "ipc/mojo/async_handle_waiter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/location.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h" 13 #include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
13 14
14 namespace IPC { 15 namespace IPC {
15 namespace internal { 16 namespace internal {
16 namespace { 17 namespace {
17 18
18 void ReadOneByteOfX(MojoHandle pipe) { 19 void ReadOneByteOfX(MojoHandle pipe) {
19 uint32_t size = 1; 20 uint32_t size = 1;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 run_loop_.reset(new base::RunLoop()); 52 run_loop_.reset(new base::RunLoop());
52 } 53 }
53 54
54 void WriteToPipe() { 55 void WriteToPipe() {
55 MojoResult rv = MojoWriteMessage(pipe_to_write_.get().value(), "X", 1, 56 MojoResult rv = MojoWriteMessage(pipe_to_write_.get().value(), "X", 1,
56 nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE); 57 nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE);
57 CHECK_EQ(rv, MOJO_RESULT_OK); 58 CHECK_EQ(rv, MOJO_RESULT_OK);
58 } 59 }
59 60
60 void WriteToPipeFromWorker() { 61 void WriteToPipeFromWorker() {
61 worker_.message_loop_proxy()->PostTask( 62 worker_.task_runner()->PostTask(
62 FROM_HERE, base::Bind(&AsyncHandleWaiterTest::WriteToPipe, 63 FROM_HERE, base::Bind(&AsyncHandleWaiterTest::WriteToPipe,
63 base::Unretained(this))); 64 base::Unretained(this)));
64 } 65 }
65 66
66 void WaitAndAssertSignaledAndMessageIsArrived() { 67 void WaitAndAssertSignaledAndMessageIsArrived() {
67 run_loop_->Run(); 68 run_loop_->Run();
68 EXPECT_EQ(MOJO_RESULT_OK, signaled_result_); 69 EXPECT_EQ(MOJO_RESULT_OK, signaled_result_);
69 70
70 ReadOneByteOfX(pipe_to_read_.get().value()); 71 ReadOneByteOfX(pipe_to_read_.get().value());
71 } 72 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 target_->GetIOObserverForTest()->DidProcessIOEvent(); 248 target_->GetIOObserverForTest()->DidProcessIOEvent();
248 EXPECT_EQ(0U, invocation_count_); 249 EXPECT_EQ(0U, invocation_count_);
249 250
250 target_->GetIOObserverForTest()->DidProcessIOEvent(); 251 target_->GetIOObserverForTest()->DidProcessIOEvent();
251 EXPECT_EQ(1U, invocation_count_); 252 EXPECT_EQ(1U, invocation_count_);
252 } 253 }
253 254
254 } // namespace 255 } // namespace
255 } // namespace internal 256 } // namespace internal
256 } // namespace IPC 257 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_test_base.cc ('k') | ipc/mojo/ipc_channel_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698