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

Side by Side Diff: dbus/mock_unittest.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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 | « dbus/end_to_end_async_unittest.cc ('k') | dbus/object_manager_unittest.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 (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 <memory> 5 #include <memory>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/single_thread_task_runner.h"
12 #include "dbus/message.h" 13 #include "dbus/message.h"
13 #include "dbus/mock_bus.h" 14 #include "dbus/mock_bus.h"
14 #include "dbus/mock_exported_object.h" 15 #include "dbus/mock_exported_object.h"
15 #include "dbus/mock_object_proxy.h" 16 #include "dbus/mock_object_proxy.h"
16 #include "dbus/object_path.h" 17 #include "dbus/object_path.h"
17 #include "dbus/scoped_dbus_error.h" 18 #include "dbus/scoped_dbus_error.h"
18 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 using ::testing::_; 22 using ::testing::_;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return NULL; 115 return NULL;
115 } 116 }
116 117
117 // Creates a response and runs the given response callback in the 118 // Creates a response and runs the given response callback in the
118 // message loop with the response. Used to implement for |mock_proxy_|. 119 // message loop with the response. Used to implement for |mock_proxy_|.
119 void HandleMockProxyResponseWithMessageLoop( 120 void HandleMockProxyResponseWithMessageLoop(
120 MethodCall* method_call, 121 MethodCall* method_call,
121 int timeout_ms, 122 int timeout_ms,
122 ObjectProxy::ResponseCallback response_callback) { 123 ObjectProxy::ResponseCallback response_callback) {
123 Response* response = CreateMockProxyResponse(method_call, timeout_ms); 124 Response* response = CreateMockProxyResponse(method_call, timeout_ms);
124 message_loop_.PostTask(FROM_HERE, 125 message_loop_.task_runner()->PostTask(
125 base::Bind(&MockTest::RunResponseCallback, 126 FROM_HERE,
126 base::Unretained(this), 127 base::Bind(&MockTest::RunResponseCallback, base::Unretained(this),
127 response_callback, 128 response_callback, response));
128 response));
129 } 129 }
130 130
131 // Runs the given response callback with the given response. 131 // Runs the given response callback with the given response.
132 void RunResponseCallback( 132 void RunResponseCallback(
133 ObjectProxy::ResponseCallback response_callback, 133 ObjectProxy::ResponseCallback response_callback,
134 Response* response) { 134 Response* response) {
135 response_callback.Run(response); 135 response_callback.Run(response);
136 delete response; 136 delete response;
137 } 137 }
138 }; 138 };
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 ObjectProxy::TIMEOUT_USE_DEFAULT, 206 ObjectProxy::TIMEOUT_USE_DEFAULT,
207 base::Bind(&MockTest::OnResponse, 207 base::Bind(&MockTest::OnResponse,
208 base::Unretained(this))); 208 base::Unretained(this)));
209 // Run the message loop to let OnResponse be called. 209 // Run the message loop to let OnResponse be called.
210 run_loop_->Run(); 210 run_loop_->Run();
211 211
212 EXPECT_EQ(kHello, response_string_); 212 EXPECT_EQ(kHello, response_string_);
213 } 213 }
214 214
215 } // namespace dbus 215 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/end_to_end_async_unittest.cc ('k') | dbus/object_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698