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

Unified Diff: mojo/public/cpp/bindings/tests/binding_unittest.cc

Issue 1535943002: Convert Pass()→std::move() in //mojo/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove self-move checks to avoid triggering clang warning. Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/tests/binding_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/binding_unittest.cc b/mojo/public/cpp/bindings/tests/binding_unittest.cc
index 1462b339926e79a7b922a61941e0e2c4993ab362..19aa998fdef24e303ab6c9516550baddcf52b1ff 100644
--- a/mojo/public/cpp/bindings/tests/binding_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/binding_unittest.cc
@@ -5,6 +5,8 @@
// Note: This file tests both binding.h (mojo::Binding) and strong_binding.h
// (mojo::StrongBinding).
+#include <utility>
+
#include "base/message_loop/message_loop.h"
#include "mojo/message_pump/message_pump_mojo.h"
#include "mojo/public/cpp/bindings/binding.h"
@@ -64,7 +66,7 @@ TEST_F(BindingTest, Close) {
auto request = GetProxy(&ptr);
ptr.set_connection_error_handler([&called]() { called = true; });
ServiceImpl impl;
- Binding<sample::Service> binding(&impl, request.Pass());
+ Binding<sample::Service> binding(&impl, std::move(request));
binding.Close();
EXPECT_FALSE(called);
@@ -83,7 +85,7 @@ TEST_F(BindingTest, DestroyClosesMessagePipe) {
bool called = false;
auto called_cb = [&called](int32_t result) { called = true; };
{
- Binding<sample::Service> binding(&impl, request.Pass());
+ Binding<sample::Service> binding(&impl, std::move(request));
ptr->Frobinate(nullptr, sample::Service::BAZ_OPTIONS_REGULAR, nullptr,
called_cb);
loop().RunUntilIdle();
@@ -145,7 +147,7 @@ class ServiceImplWithBinding : public ServiceImpl {
public:
ServiceImplWithBinding(bool* was_deleted,
InterfaceRequest<sample::Service> request)
- : ServiceImpl(was_deleted), binding_(this, request.Pass()) {
+ : ServiceImpl(was_deleted), binding_(this, std::move(request)) {
binding_.set_connection_error_handler([this]() { delete this; });
}
@@ -190,7 +192,7 @@ TEST_F(BindingTest, Unbind) {
EXPECT_FALSE(called);
called = false;
- binding.Bind(request.Pass());
+ binding.Bind(std::move(request));
EXPECT_TRUE(binding.is_bound());
// ...and should succeed again when the rebound.
ptr->Frobinate(nullptr, sample::Service::BAZ_OPTIONS_REGULAR, nullptr,
@@ -227,7 +229,7 @@ TEST_F(BindingTest, PauseResume) {
sample::ServicePtr ptr;
auto request = GetProxy(&ptr);
ServiceImpl impl;
- Binding<sample::Service> binding(&impl, request.Pass());
+ Binding<sample::Service> binding(&impl, std::move(request));
binding.PauseIncomingMethodCallProcessing();
ptr->Frobinate(nullptr, sample::Service::BAZ_OPTIONS_REGULAR, nullptr,
called_cb);
@@ -248,7 +250,7 @@ TEST_F(BindingTest, ErrorHandleNotRunWhilePaused) {
sample::ServicePtr ptr;
auto request = GetProxy(&ptr);
ServiceImpl impl;
- Binding<sample::Service> binding(&impl, request.Pass());
+ Binding<sample::Service> binding(&impl, std::move(request));
binding.set_connection_error_handler([&called]() { called = true; });
binding.PauseIncomingMethodCallProcessing();
@@ -280,7 +282,7 @@ TEST_F(StrongBindingTest, DestroyClosesMessagePipe) {
bool called = false;
auto called_cb = [&called](int32_t result) { called = true; };
{
- StrongBinding<sample::Service> binding(&impl, request.Pass());
+ StrongBinding<sample::Service> binding(&impl, std::move(request));
ptr->Frobinate(nullptr, sample::Service::BAZ_OPTIONS_REGULAR, nullptr,
called_cb);
loop().RunUntilIdle();
@@ -299,7 +301,7 @@ class ServiceImplWithStrongBinding : public ServiceImpl {
public:
ServiceImplWithStrongBinding(bool* was_deleted,
InterfaceRequest<sample::Service> request)
- : ServiceImpl(was_deleted), binding_(this, request.Pass()) {}
+ : ServiceImpl(was_deleted), binding_(this, std::move(request)) {}
StrongBinding<sample::Service>& binding() { return binding_; }
@@ -338,7 +340,7 @@ TEST_F(StrongBindingTest, ExplicitDeleteImpl) {
[&ptr_error_handler_called]() { ptr_error_handler_called = true; });
bool was_deleted = false;
ServiceImplWithStrongBinding* impl =
- new ServiceImplWithStrongBinding(&was_deleted, request.Pass());
+ new ServiceImplWithStrongBinding(&was_deleted, std::move(request));
bool binding_error_handler_called = false;
impl->binding().set_connection_error_handler(
[&binding_error_handler_called]() {

Powered by Google App Engine
This is Rietveld 408576698