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

Side by Side Diff: chromeos/dbus/services/service_provider_test_helper.cc

Issue 1782963002: Remove std::mem_fun uses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 (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 "chromeos/dbus/services/service_provider_test_helper.h" 5 #include "chromeos/dbus/services/service_provider_test_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "dbus/message.h" 10 #include "dbus/message.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 .WillOnce(Invoke(this, &ServiceProviderTestHelper::MockExportMethod)); 54 .WillOnce(Invoke(this, &ServiceProviderTestHelper::MockExportMethod));
55 55
56 // Create a mock object proxy, with which we call a method of 56 // Create a mock object proxy, with which we call a method of
57 // |mock_exported_object_|. 57 // |mock_exported_object_|.
58 mock_object_proxy_ = 58 mock_object_proxy_ =
59 new dbus::MockObjectProxy(mock_bus_.get(), 59 new dbus::MockObjectProxy(mock_bus_.get(),
60 kLibCrosServiceName, 60 kLibCrosServiceName,
61 dbus::ObjectPath(kLibCrosServicePath)); 61 dbus::ObjectPath(kLibCrosServicePath));
62 // |mock_object_proxy_|'s MockCallMethodAndBlock() will use 62 // |mock_object_proxy_|'s MockCallMethodAndBlock() will use
63 // MockCallMethodAndBlock() to return responses. 63 // MockCallMethodAndBlock() to return responses.
64 struct InterfaceGetter {
65 using result_type = std::string;
66 std::string operator()(dbus::MethodCall* method_call) {
67 return method_call->GetInterface();
68 }
69 };
Nico 2016/03/10 22:23:19 I love all the other changes in this CL, but this
vmpstr 2016/03/10 22:45:00 I figured that it's probably OK since this is test
70
71 struct MemberGetter {
72 using result_type = std::string;
73 std::string operator()(dbus::MethodCall* method_call) {
74 return method_call->GetMember();
75 }
76 };
77
64 EXPECT_CALL(*mock_object_proxy_.get(), 78 EXPECT_CALL(*mock_object_proxy_.get(),
65 MockCallMethodAndBlock( 79 MockCallMethodAndBlock(
66 AllOf(ResultOf(std::mem_fun(&dbus::MethodCall::GetInterface), 80 AllOf(ResultOf(InterfaceGetter(), kLibCrosServiceInterface),
67 kLibCrosServiceInterface), 81 ResultOf(MemberGetter(), exported_method_name)),
68 ResultOf(std::mem_fun(&dbus::MethodCall::GetMember),
69 exported_method_name)),
70 _)) 82 _))
71 .WillOnce( 83 .WillOnce(
72 Invoke(this, &ServiceProviderTestHelper::MockCallMethodAndBlock)); 84 Invoke(this, &ServiceProviderTestHelper::MockCallMethodAndBlock));
73 85
74 service_provider->Start(mock_exported_object_.get()); 86 service_provider->Start(mock_exported_object_.get());
75 } 87 }
76 88
77 void ServiceProviderTestHelper::TearDown() { 89 void ServiceProviderTestHelper::TearDown() {
78 mock_bus_->ShutdownAndBlock(); 90 mock_bus_->ShutdownAndBlock();
79 mock_exported_object_ = NULL; 91 mock_exported_object_ = NULL;
80 mock_object_proxy_ = NULL; 92 mock_object_proxy_ = NULL;
81 mock_bus_ = NULL; 93 mock_bus_ = NULL;
82 } 94 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 169
158 void ServiceProviderTestHelper::OnResponse( 170 void ServiceProviderTestHelper::OnResponse(
159 scoped_ptr<dbus::Response> response) { 171 scoped_ptr<dbus::Response> response) {
160 response_ = std::move(response); 172 response_ = std::move(response);
161 response_received_ = true; 173 response_received_ = true;
162 if (base::MessageLoop::current()->is_running()) 174 if (base::MessageLoop::current()->is_running())
163 base::MessageLoop::current()->QuitWhenIdle(); 175 base::MessageLoop::current()->QuitWhenIdle();
164 } 176 }
165 177
166 } // namespace chromeos 178 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698