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

Side by Side Diff: mojo/services/network/udp_socket_apptest.cc

Issue 1455833005: Convert ConnectToApplication to take a params class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/macros.h" 5 #include "base/macros.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "mojo/application/public/cpp/application_connection.h" 8 #include "mojo/application/public/cpp/application_connection.h"
9 #include "mojo/application/public/cpp/application_impl.h" 9 #include "mojo/application/public/cpp/application_impl.h"
10 #include "mojo/application/public/cpp/application_test_base.h" 10 #include "mojo/application/public/cpp/application_test_base.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 DISALLOW_COPY_AND_ASSIGN(UDPSocketReceiverImpl); 314 DISALLOW_COPY_AND_ASSIGN(UDPSocketReceiverImpl);
315 }; 315 };
316 316
317 class UDPSocketAppTest : public test::ApplicationTestBase { 317 class UDPSocketAppTest : public test::ApplicationTestBase {
318 public: 318 public:
319 UDPSocketAppTest() : receiver_binding_(&receiver_) {} 319 UDPSocketAppTest() : receiver_binding_(&receiver_) {}
320 ~UDPSocketAppTest() override {} 320 ~UDPSocketAppTest() override {}
321 321
322 void SetUp() override { 322 void SetUp() override {
323 ApplicationTestBase::SetUp(); 323 ApplicationTestBase::SetUp();
324 324 application_impl()->ConnectToService("mojo:network_service",
325 mojo::URLRequestPtr request(mojo::URLRequest::New()); 325 &network_service_);
326 request->url = mojo::String::From("mojo:network_service");
327 scoped_ptr<ApplicationConnection> connection =
328 application_impl()->ConnectToApplication(request.Pass());
329 connection->ConnectToService(&network_service_);
330
331 network_service_->CreateUDPSocket(GetProxy(&socket_)); 326 network_service_->CreateUDPSocket(GetProxy(&socket_));
332 } 327 }
333 328
334 protected: 329 protected:
335 NetworkServicePtr network_service_; 330 NetworkServicePtr network_service_;
336 UDPSocketPtr socket_; 331 UDPSocketPtr socket_;
337 UDPSocketReceiverImpl receiver_; 332 UDPSocketReceiverImpl receiver_;
338 Binding<UDPSocketReceiver> receiver_binding_; 333 Binding<UDPSocketReceiver> receiver_binding_;
339 334
340 DISALLOW_COPY_AND_ASSIGN(UDPSocketAppTest); 335 DISALLOW_COPY_AND_ASSIGN(UDPSocketAppTest);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 receive_callbacks[j].result()->code); 640 receive_callbacks[j].result()->code);
646 EXPECT_FALSE(receive_callbacks[j].src_addr()); 641 EXPECT_FALSE(receive_callbacks[j].src_addr());
647 EXPECT_TRUE(receive_callbacks[j].data().Equals( 642 EXPECT_TRUE(receive_callbacks[j].data().Equals(
648 CreateTestMessage(static_cast<uint8_t>(j), kDatagramSize))); 643 CreateTestMessage(static_cast<uint8_t>(j), kDatagramSize)));
649 } 644 }
650 } 645 }
651 } 646 }
652 647
653 } // namespace service 648 } // namespace service
654 } // namespace mojo 649 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/network/network_service_delegate.cc ('k') | mojo/services/test_service/test_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698