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

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

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 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 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "mojo/public/cpp/bindings/callback.h" 13 #include "mojo/public/cpp/bindings/callback.h"
14 #include "mojo/services/network/public/cpp/udp_socket_wrapper.h" 14 #include "mojo/services/network/public/cpp/udp_socket_wrapper.h"
15 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 15 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
16 #include "mojo/services/network/public/interfaces/udp_socket.mojom.h" 16 #include "mojo/services/network/public/interfaces/udp_socket.mojom.h"
17 #include "mojo/shell/public/cpp/application_connection.h" 17 #include "mojo/shell/public/cpp/application_connection.h"
18 #include "mojo/shell/public/cpp/application_impl.h"
19 #include "mojo/shell/public/cpp/application_test_base.h" 18 #include "mojo/shell/public/cpp/application_test_base.h"
20 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
21 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
22 21
23 namespace mojo { 22 namespace mojo {
24 namespace service { 23 namespace service {
25 namespace { 24 namespace {
26 25
27 NetAddressPtr GetLocalHostWithAnyPort() { 26 NetAddressPtr GetLocalHostWithAnyPort() {
28 NetAddressPtr addr(NetAddress::New()); 27 NetAddressPtr addr(NetAddress::New());
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 DISALLOW_COPY_AND_ASSIGN(UDPSocketReceiverImpl); 318 DISALLOW_COPY_AND_ASSIGN(UDPSocketReceiverImpl);
320 }; 319 };
321 320
322 class UDPSocketAppTest : public test::ApplicationTestBase { 321 class UDPSocketAppTest : public test::ApplicationTestBase {
323 public: 322 public:
324 UDPSocketAppTest() : receiver_binding_(&receiver_) {} 323 UDPSocketAppTest() : receiver_binding_(&receiver_) {}
325 ~UDPSocketAppTest() override {} 324 ~UDPSocketAppTest() override {}
326 325
327 void SetUp() override { 326 void SetUp() override {
328 ApplicationTestBase::SetUp(); 327 ApplicationTestBase::SetUp();
329 application_impl()->ConnectToService("mojo:network_service", 328 shell()->ConnectToService("mojo:network_service", &network_service_);
330 &network_service_);
331 network_service_->CreateUDPSocket(GetProxy(&socket_)); 329 network_service_->CreateUDPSocket(GetProxy(&socket_));
332 } 330 }
333 331
334 protected: 332 protected:
335 NetworkServicePtr network_service_; 333 NetworkServicePtr network_service_;
336 UDPSocketPtr socket_; 334 UDPSocketPtr socket_;
337 UDPSocketReceiverImpl receiver_; 335 UDPSocketReceiverImpl receiver_;
338 Binding<UDPSocketReceiver> receiver_binding_; 336 Binding<UDPSocketReceiver> receiver_binding_;
339 337
340 DISALLOW_COPY_AND_ASSIGN(UDPSocketAppTest); 338 DISALLOW_COPY_AND_ASSIGN(UDPSocketAppTest);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 receive_callbacks[j].result()->code); 643 receive_callbacks[j].result()->code);
646 EXPECT_FALSE(receive_callbacks[j].src_addr()); 644 EXPECT_FALSE(receive_callbacks[j].src_addr());
647 EXPECT_TRUE(receive_callbacks[j].data().Equals( 645 EXPECT_TRUE(receive_callbacks[j].data().Equals(
648 CreateTestMessage(static_cast<uint8_t>(j), kDatagramSize))); 646 CreateTestMessage(static_cast<uint8_t>(j), kDatagramSize)));
649 } 647 }
650 } 648 }
651 } 649 }
652 650
653 } // namespace service 651 } // namespace service
654 } // namespace mojo 652 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/network/network_service_delegate.cc ('k') | mojo/services/test_service/test_request_tracker_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698