| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ppapi/tests/test_host_resolver.h" | 5 #include "ppapi/tests/test_host_resolver.h" |
| 6 | 6 |
| 7 #include "ppapi/cpp/host_resolver.h" | 7 #include "ppapi/cpp/host_resolver.h" |
| 8 #include "ppapi/cpp/net_address.h" | 8 #include "ppapi/cpp/net_address.h" |
| 9 #include "ppapi/cpp/tcp_socket.h" | 9 #include "ppapi/cpp/tcp_socket.h" |
| 10 #include "ppapi/cpp/var.h" | 10 #include "ppapi/cpp/var.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 ASSERT_SUBTEST_SUCCESS(SyncResolve(&host_resolver, host_, port_, hint)); | 117 ASSERT_SUBTEST_SUCCESS(SyncResolve(&host_resolver, host_, port_, hint)); |
| 118 | 118 |
| 119 size_t size = host_resolver.GetNetAddressCount(); | 119 size_t size = host_resolver.GetNetAddressCount(); |
| 120 ASSERT_TRUE(size >= 1); | 120 ASSERT_TRUE(size >= 1); |
| 121 | 121 |
| 122 pp::NetAddress address; | 122 pp::NetAddress address; |
| 123 for (size_t i = 0; i < size; ++i) { | 123 for (size_t i = 0; i < size; ++i) { |
| 124 address = host_resolver.GetNetAddress(i); | 124 address = host_resolver.GetNetAddress(i); |
| 125 ASSERT_NE(0, address.pp_resource()); | 125 ASSERT_NE(0, address.pp_resource()); |
| 126 | 126 |
| 127 pp::TCPSocket socket(instance_); | 127 pp::TCPSocket socket(instance_, address.GetFamily()); |
| 128 ASSERT_SUBTEST_SUCCESS(SyncConnect(&socket, address)); | 128 ASSERT_SUBTEST_SUCCESS(SyncConnect(&socket, address)); |
| 129 ASSERT_SUBTEST_SUCCESS(CheckHTTPResponse(&socket, | 129 ASSERT_SUBTEST_SUCCESS(CheckHTTPResponse(&socket, |
| 130 "GET / HTTP/1.0\r\n\r\n", | 130 "GET / HTTP/1.0\r\n\r\n", |
| 131 "HTTP")); | 131 "HTTP")); |
| 132 socket.Close(); | 132 socket.Close(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 address = host_resolver.GetNetAddress(size); | 135 address = host_resolver.GetNetAddress(size); |
| 136 ASSERT_EQ(0, address.pp_resource()); | 136 ASSERT_EQ(0, address.pp_resource()); |
| 137 pp::Var canonical_name = host_resolver.GetCanonicalName(); | 137 pp::Var canonical_name = host_resolver.GetCanonicalName(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 160 hint.flags = PP_HOSTRESOLVER_FLAG_CANONNAME; | 160 hint.flags = PP_HOSTRESOLVER_FLAG_CANONNAME; |
| 161 return ParameterizedTestResolve(hint); | 161 return ParameterizedTestResolve(hint); |
| 162 } | 162 } |
| 163 | 163 |
| 164 std::string TestHostResolver::TestResolveIPv4() { | 164 std::string TestHostResolver::TestResolveIPv4() { |
| 165 PP_HostResolver_Hint hint; | 165 PP_HostResolver_Hint hint; |
| 166 hint.family = PP_NETADDRESS_FAMILY_IPV4; | 166 hint.family = PP_NETADDRESS_FAMILY_IPV4; |
| 167 hint.flags = PP_HOSTRESOLVER_FLAG_CANONNAME; | 167 hint.flags = PP_HOSTRESOLVER_FLAG_CANONNAME; |
| 168 return ParameterizedTestResolve(hint); | 168 return ParameterizedTestResolve(hint); |
| 169 } | 169 } |
| OLD | NEW |