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

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: Regenerate correctly 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 c1d55dd033146477f232ecc9c5371ada851f8884..91002a4503cb21edd7a4be87067596d182fad31e 100644
--- a/mojo/public/cpp/bindings/tests/binding_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/binding_unittest.cc
@@ -5,11 +5,13 @@
// Note: This file tests both binding.h (mojo::Binding) and strong_binding.h
// (mojo::StrongBinding).
+#include "mojo/public/cpp/bindings/binding.h"
+
#include <stdint.h>
+#include <utility>
#include "base/message_loop/message_loop.h"
#include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/system/macros.h"
#include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
@@ -66,7 +68,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);
@@ -85,7 +87,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();
@@ -147,7 +149,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; });
}
@@ -192,7 +194,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,
@@ -229,7 +231,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);
@@ -250,7 +252,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();
@@ -282,7 +284,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();
@@ -301,7 +303,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_; }
@@ -340,7 +342,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]() {
« no previous file with comments | « mojo/public/cpp/bindings/tests/associated_interface_unittest.cc ('k') | mojo/public/cpp/bindings/tests/bindings_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698