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 "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/services/network/interfaces/network_service.mojom.h" | 8 #include "mojo/services/network/interfaces/network_service.mojom.h" |
9 #include "mojo/services/network/interfaces/udp_socket.mojom.h" | 9 #include "mojo/services/network/interfaces/udp_socket.mojom.h" |
10 #include "mojo/services/network/udp_socket_wrapper.h" | 10 #include "mojo/services/network/udp_socket_wrapper.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 addr->ipv4->addr.resize(4); | 27 addr->ipv4->addr.resize(4); |
28 addr->ipv4->addr[0] = 127; | 28 addr->ipv4->addr[0] = 127; |
29 addr->ipv4->addr[1] = 0; | 29 addr->ipv4->addr[1] = 0; |
30 addr->ipv4->addr[2] = 0; | 30 addr->ipv4->addr[2] = 0; |
31 addr->ipv4->addr[3] = 1; | 31 addr->ipv4->addr[3] = 1; |
32 | 32 |
33 return addr.Pass(); | 33 return addr.Pass(); |
34 } | 34 } |
35 | 35 |
36 Array<uint8_t> CreateTestMessage(uint8_t initial, size_t size) { | 36 Array<uint8_t> CreateTestMessage(uint8_t initial, size_t size) { |
37 Array<uint8_t> array(size); | 37 auto array = Array<uint8_t>::New(size); |
38 for (size_t i = 0; i < size; ++i) | 38 for (size_t i = 0; i < size; ++i) |
39 array[i] = static_cast<uint8_t>((i + initial) % 256); | 39 array[i] = static_cast<uint8_t>((i + initial) % 256); |
40 return array.Pass(); | 40 return array.Pass(); |
41 } | 41 } |
42 | 42 |
43 template <typename CallbackType> | 43 template <typename CallbackType> |
44 class TestCallbackBase { | 44 class TestCallbackBase { |
45 public: | 45 public: |
46 TestCallbackBase() : state_(nullptr), run_loop_(nullptr), ran_(false) {} | 46 TestCallbackBase() : state_(nullptr), run_loop_(nullptr), ran_(false) {} |
47 | 47 |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 receive_callbacks[j].result()->code); | 643 receive_callbacks[j].result()->code); |
644 EXPECT_FALSE(receive_callbacks[j].src_addr()); | 644 EXPECT_FALSE(receive_callbacks[j].src_addr()); |
645 EXPECT_TRUE(receive_callbacks[j].data().Equals( | 645 EXPECT_TRUE(receive_callbacks[j].data().Equals( |
646 CreateTestMessage(static_cast<uint8_t>(j), kDatagramSize))); | 646 CreateTestMessage(static_cast<uint8_t>(j), kDatagramSize))); |
647 } | 647 } |
648 } | 648 } |
649 } | 649 } |
650 | 650 |
651 } // namespace service | 651 } // namespace service |
652 } // namespace mojo | 652 } // namespace mojo |
OLD | NEW |