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

Side by Side Diff: net/dns/dns_config_service_posix_unittest.cc

Issue 9369045: [net] HostResolverImpl + DnsTransaction + DnsConfigService = Asynchronous DNS ready for experiments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Denitted. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « net/dns/dns_config_service_posix.cc ('k') | net/dns/dns_config_service_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <resolv.h> 5 #include <resolv.h>
6 6
7 #include "base/sys_byteorder.h" 7 #include "base/sys_byteorder.h"
8 #include "net/dns/dns_config_service_posix.h" 8 #include "net/dns/dns_config_service_posix.h"
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 #if defined(OS_LINUX) 103 #if defined(OS_LINUX)
104 for (int i = 0; i < res->_u._ext.nscount6; ++i) { 104 for (int i = 0; i < res->_u._ext.nscount6; ++i) {
105 ASSERT_TRUE(res->_u._ext.nsaddrs[i] != NULL); 105 ASSERT_TRUE(res->_u._ext.nsaddrs[i] != NULL);
106 free(res->_u._ext.nsaddrs[i]); 106 free(res->_u._ext.nsaddrs[i]);
107 } 107 }
108 #endif 108 #endif
109 } 109 }
110 110
111 } // namespace 111 } // namespace
112 112
113 TEST(DnsConfigTest, ResolverConfigConvertAndEquals) { 113 TEST(DnsConfigServicePosixTest, ConvertResStateToDnsConfig) {
114 struct __res_state res[2]; 114 struct __res_state res[2];
115 DnsConfig config[2]; 115 DnsConfig config[2];
116 for (unsigned i = 0; i < 2; ++i) { 116 for (unsigned i = 0; i < 2; ++i) {
117 EXPECT_FALSE(config[i].IsValid()); 117 EXPECT_FALSE(config[i].IsValid());
118 InitializeResState(&res[i], i); 118 InitializeResState(&res[i], i);
119 ASSERT_TRUE(ConvertResStateToDnsConfig(res[i], &config[i])); 119 ASSERT_TRUE(ConvertResStateToDnsConfig(res[i], &config[i]));
120 } 120 }
121 for (unsigned i = 0; i < 2; ++i) { 121 for (unsigned i = 0; i < 2; ++i) {
122 EXPECT_TRUE(config[i].IsValid()); 122 EXPECT_TRUE(config[i].IsValid());
123 CompareConfig(res[i], config[i]); 123 CompareConfig(res[i], config[i]);
124 CloseResState(&res[i]); 124 CloseResState(&res[i]);
125 } 125 }
126 EXPECT_TRUE(config[0].Equals(config[0])); 126 EXPECT_TRUE(config[0].Equals(config[0]));
127 EXPECT_FALSE(config[0].Equals(config[1])); 127 EXPECT_FALSE(config[0].Equals(config[1]));
128 EXPECT_FALSE(config[1].Equals(config[0])); 128 EXPECT_FALSE(config[1].Equals(config[0]));
129 } 129 }
130 130
131 } // namespace net 131 } // namespace net
132 132
133 133
OLDNEW
« no previous file with comments | « net/dns/dns_config_service_posix.cc ('k') | net/dns/dns_config_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698