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

Side by Side Diff: dbus/mock_unittest.cc

Issue 14386016: dbus: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "dbus/message.h" 10 #include "dbus/message.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // payload to |response_string_|. 70 // payload to |response_string_|.
71 if (response) { 71 if (response) {
72 dbus::MessageReader reader(response); 72 dbus::MessageReader reader(response);
73 ASSERT_TRUE(reader.PopString(&response_string_)); 73 ASSERT_TRUE(reader.PopString(&response_string_));
74 } 74 }
75 message_loop_.Quit(); 75 message_loop_.Quit();
76 }; 76 };
77 77
78 protected: 78 protected:
79 std::string response_string_; 79 std::string response_string_;
80 MessageLoop message_loop_; 80 base::MessageLoop message_loop_;
81 scoped_refptr<dbus::MockBus> mock_bus_; 81 scoped_refptr<dbus::MockBus> mock_bus_;
82 scoped_refptr<dbus::MockObjectProxy> mock_proxy_; 82 scoped_refptr<dbus::MockObjectProxy> mock_proxy_;
83 83
84 private: 84 private:
85 // Returns a response for the given method call. Used to implement 85 // Returns a response for the given method call. Used to implement
86 // CallMethodAndBlock() for |mock_proxy_|. 86 // CallMethodAndBlock() for |mock_proxy_|.
87 dbus::Response* CreateMockProxyResponse(dbus::MethodCall* method_call, 87 dbus::Response* CreateMockProxyResponse(dbus::MethodCall* method_call,
88 int timeout_ms) { 88 int timeout_ms) {
89 if (method_call->GetInterface() == "org.chromium.TestInterface" && 89 if (method_call->GetInterface() == "org.chromium.TestInterface" &&
90 method_call->GetMember() == "Echo") { 90 method_call->GetMember() == "Echo") {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // Call the method. 172 // Call the method.
173 proxy->CallMethod(&method_call, 173 proxy->CallMethod(&method_call,
174 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 174 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
175 base::Bind(&MockTest::OnResponse, 175 base::Bind(&MockTest::OnResponse,
176 base::Unretained(this))); 176 base::Unretained(this)));
177 // Run the message loop to let OnResponse be called. 177 // Run the message loop to let OnResponse be called.
178 message_loop_.Run(); 178 message_loop_.Run();
179 179
180 EXPECT_EQ(kHello, response_string_); 180 EXPECT_EQ(kHello, response_string_);
181 } 181 }
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