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 <stdint.h> |
| 6 |
5 #include "base/location.h" | 7 #include "base/location.h" |
6 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
7 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
8 #include "chrome/common/local_discovery/service_discovery_client_impl.h" | 10 #include "chrome/common/local_discovery/service_discovery_client_impl.h" |
9 #include "net/dns/mdns_client_impl.h" | 11 #include "net/dns/mdns_client_impl.h" |
10 #include "net/dns/mock_mdns_socket_factory.h" | 12 #include "net/dns/mock_mdns_socket_factory.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
13 | 15 |
14 using ::testing::_; | 16 using ::testing::_; |
15 | 17 |
16 namespace local_discovery { | 18 namespace local_discovery { |
17 | 19 |
18 namespace { | 20 namespace { |
19 | 21 |
20 const uint8 kSamplePacketA[] = { | 22 const uint8_t kSamplePacketA[] = { |
21 // Header | 23 // Header |
22 0x00, 0x00, // ID is zeroed out | 24 0x00, 0x00, // ID is zeroed out |
23 0x81, 0x80, // Standard query response, RA, no error | 25 0x81, 0x80, // Standard query response, RA, no error |
24 0x00, 0x00, // No questions (for simplicity) | 26 0x00, 0x00, // No questions (for simplicity) |
25 0x00, 0x01, // 1 RR (answers) | 27 0x00, 0x01, // 1 RR (answers) |
26 0x00, 0x00, // 0 authority RRs | 28 0x00, 0x00, // 0 authority RRs |
27 0x00, 0x00, // 0 additional RRs | 29 0x00, 0x00, // 0 additional RRs |
28 | 30 |
29 0x07, 'm', 'y', 'h', 'e', 'l', 'l', 'o', | 31 0x07, 'm', 'y', 'h', 'e', 'l', 'l', 'o', |
30 0x05, 'l', 'o', 'c', 'a', 'l', | 32 0x05, 'l', 'o', 'c', 'a', 'l', |
31 0x00, | 33 0x00, |
32 0x00, 0x01, // TYPE is A. | 34 0x00, 0x01, // TYPE is A. |
33 0x00, 0x01, // CLASS is IN. | 35 0x00, 0x01, // CLASS is IN. |
34 0x00, 0x00, // TTL (4 bytes) is 16 seconds. | 36 0x00, 0x00, // TTL (4 bytes) is 16 seconds. |
35 0x00, 0x10, | 37 0x00, 0x10, |
36 0x00, 0x04, // RDLENGTH is 4 bytes. | 38 0x00, 0x04, // RDLENGTH is 4 bytes. |
37 0x01, 0x02, | 39 0x01, 0x02, |
38 0x03, 0x04, | 40 0x03, 0x04, |
39 }; | 41 }; |
40 | 42 |
41 const uint8 kSamplePacketAAAA[] = { | 43 const uint8_t kSamplePacketAAAA[] = { |
42 // Header | 44 // Header |
43 0x00, 0x00, // ID is zeroed out | 45 0x00, 0x00, // ID is zeroed out |
44 0x81, 0x80, // Standard query response, RA, no error | 46 0x81, 0x80, // Standard query response, RA, no error |
45 0x00, 0x00, // No questions (for simplicity) | 47 0x00, 0x00, // No questions (for simplicity) |
46 0x00, 0x01, // 1 RR (answers) | 48 0x00, 0x01, // 1 RR (answers) |
47 0x00, 0x00, // 0 authority RRs | 49 0x00, 0x00, // 0 authority RRs |
48 0x00, 0x00, // 0 additional RRs | 50 0x00, 0x00, // 0 additional RRs |
49 | 51 |
50 0x07, 'm', 'y', 'h', 'e', 'l', 'l', 'o', | 52 0x07, 'm', 'y', 'h', 'e', 'l', 'l', 'o', |
51 0x05, 'l', 'o', 'c', 'a', 'l', | 53 0x05, 'l', 'o', 'c', 'a', 'l', |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 resolver.Start(); | 179 resolver.Start(); |
178 | 180 |
179 EXPECT_CALL(*this, AddressCallbackInternal(false, "", "")); | 181 EXPECT_CALL(*this, AddressCallbackInternal(false, "", "")); |
180 | 182 |
181 RunFor(base::TimeDelta::FromSeconds(4)); | 183 RunFor(base::TimeDelta::FromSeconds(4)); |
182 } | 184 } |
183 | 185 |
184 } // namespace | 186 } // namespace |
185 | 187 |
186 } // namespace local_discovery | 188 } // namespace local_discovery |
OLD | NEW |