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

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

Issue 2696233002: Mojo C++ bindings: remove some usage of AssociatedGroup from user code. (Closed)
Patch Set: . Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
index a97a38d3c5841517683370d276bdb1a832ec0077..625c49c73aa357ad33d18111ced2c96c37249555 100644
--- a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
@@ -19,7 +19,6 @@
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
-#include "mojo/public/cpp/bindings/associated_group.h"
#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
#include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
#include "mojo/public/cpp/bindings/associated_interface_request.h"
@@ -80,10 +79,8 @@ class IntegerSenderConnectionImpl : public IntegerSenderConnection {
}
void AsyncGetSender(const AsyncGetSenderCallback& callback) override {
- AssociatedInterfaceRequest<IntegerSender> request;
IntegerSenderAssociatedPtrInfo ptr_info;
- binding_.associated_group()->CreateAssociatedInterface(
- AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request);
+ auto request = MakeRequest(&ptr_info);
GetSender(std::move(request));
callback.Run(std::move(ptr_info));
}
@@ -131,9 +128,7 @@ class AssociatedInterfaceTest : public testing::Test {
IntegerSenderAssociatedPtrInfo* ptr_info0,
scoped_refptr<MultiplexRouter> router1,
IntegerSenderAssociatedRequest* request1) {
- AssociatedGroup dummy_group;
- dummy_group.CreateAssociatedInterface(AssociatedGroup::WILL_PASS_PTR,
- ptr_info0, request1);
+ *request1 = MakeRequest(ptr_info0);
*ptr_info0 = EmulatePassingAssociatedPtrInfo(std::move(*ptr_info0), router1,
router0);
}
@@ -559,8 +554,7 @@ TEST_F(AssociatedInterfaceTest, PassAssociatedInterfaces) {
IntegerSenderConnectionImpl connection(MakeRequest(&connection_ptr));
IntegerSenderAssociatedPtr sender0;
- connection_ptr->GetSender(
- MakeRequest(&sender0, connection_ptr.associated_group()));
+ connection_ptr->GetSender(MakeRequest(&sender0));
int32_t echoed_value = 0;
base::RunLoop run_loop;
@@ -588,8 +582,7 @@ TEST_F(AssociatedInterfaceTest, BindingWaitAndPauseWhenNoAssociatedInterfaces) {
IntegerSenderConnectionImpl connection(MakeRequest(&connection_ptr));
IntegerSenderAssociatedPtr sender0;
- connection_ptr->GetSender(
- MakeRequest(&sender0, connection_ptr.associated_group()));
+ connection_ptr->GetSender(MakeRequest(&sender0));
EXPECT_FALSE(connection.binding()->HasAssociatedInterfaces());
// There are no associated interfaces running on the pipe yet. It is okay to
@@ -697,8 +690,8 @@ TEST_F(AssociatedInterfaceTest, BindingWithFilters) {
PingProviderImpl provider_impl(MakeRequest(&provider));
PingServiceAssociatedPtr ping_a, ping_b;
- provider->GetPing(MakeRequest(&ping_a, provider.associated_group()));
- provider->GetPing(MakeRequest(&ping_b, provider.associated_group()));
+ provider->GetPing(MakeRequest(&ping_a));
+ provider->GetPing(MakeRequest(&ping_b));
provider_impl.WaitForBindings(2);
ASSERT_EQ(2u, provider_impl.ping_services().size());
@@ -876,7 +869,7 @@ TEST_F(AssociatedInterfaceTest, StrongBindingFlushForTesting) {
MakeRequest(&ptr));
bool called = false;
IntegerSenderAssociatedPtr sender_ptr;
- ptr->GetSender(MakeRequest(&sender_ptr, ptr.associated_group()));
+ ptr->GetSender(MakeRequest(&sender_ptr));
sender_ptr->Echo(1, base::Bind(&SetBoolWithUnusedParameter<int>, &called));
EXPECT_FALSE(called);
// Because the flush is sent from the binding, it only guarantees that the
@@ -957,9 +950,8 @@ TEST_F(AssociatedInterfaceTest,
// Test that AssociatedBinding is notified with connection error when the
// interface hasn't associated with a message pipe and the peer is closed.
- AssociatedGroup dummy_group;
IntegerSenderAssociatedPtr ptr;
- IntegerSenderImpl impl(MakeRequest(&ptr, &dummy_group));
+ IntegerSenderImpl impl(MakeRequest(&ptr));
base::RunLoop run_loop;
impl.binding()->set_connection_error_with_reason_handler(base::Bind(
@@ -1004,9 +996,8 @@ TEST_F(AssociatedInterfaceTest, PendingAssociatedPtrConnectionErrorWithReason) {
// Test that AssociatedInterfacePtr is notified with connection error when the
// interface hasn't associated with a message pipe and the peer is closed.
- AssociatedGroup dummy_group;
IntegerSenderAssociatedPtr ptr;
- auto request = MakeRequest(&ptr, &dummy_group);
+ auto request = MakeRequest(&ptr);
base::RunLoop run_loop;
ptr.set_connection_error_with_reason_handler(base::Bind(
@@ -1051,8 +1042,7 @@ TEST_F(AssociatedInterfaceTest, ThreadSafeAssociatedInterfacePtr) {
IntegerSenderConnectionImpl connection(MakeRequest(&connection_ptr));
IntegerSenderAssociatedPtr sender;
- connection_ptr->GetSender(
- MakeRequest(&sender, connection_ptr.associated_group()));
+ connection_ptr->GetSender(MakeRequest(&sender));
scoped_refptr<ThreadSafeIntegerSenderAssociatedPtr> thread_safe_sender =
ThreadSafeIntegerSenderAssociatedPtr::Create(std::move(sender));
@@ -1126,11 +1116,7 @@ TEST_F(AssociatedInterfaceTest,
context->interface_impl = base::MakeUnique<IntegerSenderConnectionImpl>(
MakeRequest(&context->connection_ptr));
- IntegerSenderAssociatedPtr sender;
- IntegerSenderAssociatedRequest sender_request =
- MakeRequest(&sender, context->connection_ptr.associated_group());
- *sender_info = sender.PassInterface();
-
+ auto sender_request = MakeRequest(sender_info);
context->connection_ptr->GetSender(std::move(sender_request));
// Unblock the main thread as soon as |sender_info| is set.
@@ -1184,11 +1170,9 @@ TEST_F(AssociatedInterfaceTest, CloseWithoutBindingAssociatedRequest) {
&ping_provider_provider);
auto provider_provider = binding.CreateInterfacePtrAndBind();
AssociatedPingProviderAssociatedPtr provider;
- provider_provider->GetPingProvider(
- mojo::MakeRequest(&provider, provider_provider.associated_group()));
+ provider_provider->GetPingProvider(mojo::MakeRequest(&provider));
PingServiceAssociatedPtr ping;
- provider->GetPing(
- mojo::MakeRequest(&ping, provider.associated_group()));
+ provider->GetPing(mojo::MakeRequest(&ping));
base::RunLoop run_loop;
ping.set_connection_error_handler(run_loop.QuitClosure());
run_loop.Run();
« no previous file with comments | « mojo/public/cpp/bindings/lib/multiplex_router.cc ('k') | mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698