OLD | NEW |
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/application/public/cpp/application_connection.h" | 13 #include "mojo/application/public/cpp/application_connection.h" |
14 #include "mojo/application/public/cpp/application_impl.h" | 14 #include "mojo/application/public/cpp/application_impl.h" |
15 #include "mojo/application/public/cpp/application_test_base.h" | 15 #include "mojo/application/public/cpp/application_test_base.h" |
16 #include "mojo/public/cpp/bindings/callback.h" | 16 #include "mojo/public/cpp/bindings/callback.h" |
17 #include "mojo/services/network/public/cpp/udp_socket_wrapper.h" | 17 #include "mojo/services/network/public/cpp/udp_socket_wrapper.h" |
18 #include "mojo/services/network/public/interfaces/network_service.mojom.h" | 18 #include "mojo/services/network/public/interfaces/network_service.mojom.h" |
19 #include "mojo/services/network/public/interfaces/udp_socket.mojom.h" | 19 #include "mojo/services/network/public/interfaces/udp_socket.mojom.h" |
20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 namespace mojo { | 23 namespace mojo { |
24 namespace service { | 24 namespace service { |
25 namespace { | 25 namespace { |
26 | 26 |
27 NetAddressPtr GetLocalHostWithAnyPort() { | 27 NetAddressPtr GetLocalHostWithAnyPort() { |
28 NetAddressPtr addr(NetAddress::New()); | 28 NetAddressPtr addr(NetAddress::New()); |
29 addr->family = NET_ADDRESS_FAMILY_IPV4; | 29 addr->family = NetAddressFamily::IPV4; |
30 addr->ipv4 = NetAddressIPv4::New(); | 30 addr->ipv4 = NetAddressIPv4::New(); |
31 addr->ipv4->port = 0; | 31 addr->ipv4->port = 0; |
32 addr->ipv4->addr.resize(4); | 32 addr->ipv4->addr.resize(4); |
33 addr->ipv4->addr[0] = 127; | 33 addr->ipv4->addr[0] = 127; |
34 addr->ipv4->addr[1] = 0; | 34 addr->ipv4->addr[1] = 0; |
35 addr->ipv4->addr[2] = 0; | 35 addr->ipv4->addr[2] = 0; |
36 addr->ipv4->addr[3] = 1; | 36 addr->ipv4->addr[3] = 1; |
37 | 37 |
38 return addr; | 38 return addr; |
39 } | 39 } |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 receive_callbacks[j].result()->code); | 645 receive_callbacks[j].result()->code); |
646 EXPECT_FALSE(receive_callbacks[j].src_addr()); | 646 EXPECT_FALSE(receive_callbacks[j].src_addr()); |
647 EXPECT_TRUE(receive_callbacks[j].data().Equals( | 647 EXPECT_TRUE(receive_callbacks[j].data().Equals( |
648 CreateTestMessage(static_cast<uint8_t>(j), kDatagramSize))); | 648 CreateTestMessage(static_cast<uint8_t>(j), kDatagramSize))); |
649 } | 649 } |
650 } | 650 } |
651 } | 651 } |
652 | 652 |
653 } // namespace service | 653 } // namespace service |
654 } // namespace mojo | 654 } // namespace mojo |
OLD | NEW |