| 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 "chromeos/network/host_resolver_impl_chromeos.h" | 5 #include "chromeos/network/host_resolver_impl_chromeos.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 // Create the host resolver from the IO message loop. | 65 // Create the host resolver from the IO message loop. |
| 66 io_message_loop_.task_runner()->PostTask( | 66 io_message_loop_.task_runner()->PostTask( |
| 67 FROM_HERE, | 67 FROM_HERE, |
| 68 base::Bind(&HostResolverImplChromeOSTest::InitializeHostResolver, | 68 base::Bind(&HostResolverImplChromeOSTest::InitializeHostResolver, |
| 69 base::Unretained(this))); | 69 base::Unretained(this))); |
| 70 base::RunLoop().RunUntilIdle(); | 70 base::RunLoop().RunUntilIdle(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void TearDown() override { | 73 void TearDown() override { |
| 74 network_state_handler_->Shutdown(); |
| 74 network_state_handler_.reset(); | 75 network_state_handler_.reset(); |
| 75 DBusThreadManager::Shutdown(); | 76 DBusThreadManager::Shutdown(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 protected: | 79 protected: |
| 79 // Run from main (UI) message loop, calls Resolve on IO message loop. | 80 // Run from main (UI) message loop, calls Resolve on IO message loop. |
| 80 int CallResolve(net::HostResolver::RequestInfo& info) { | 81 int CallResolve(net::HostResolver::RequestInfo& info) { |
| 81 io_message_loop_.task_runner()->PostTask( | 82 io_message_loop_.task_runner()->PostTask( |
| 82 FROM_HERE, base::Bind(&HostResolverImplChromeOSTest::Resolve, | 83 FROM_HERE, base::Bind(&HostResolverImplChromeOSTest::Resolve, |
| 83 base::Unretained(this), info)); | 84 base::Unretained(this), info)); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 info.set_address_family(net::ADDRESS_FAMILY_IPV6); | 156 info.set_address_family(net::ADDRESS_FAMILY_IPV6); |
| 156 EXPECT_EQ(net::OK, CallResolve(info)); | 157 EXPECT_EQ(net::OK, CallResolve(info)); |
| 157 ASSERT_EQ(2u, addresses_.size()); | 158 ASSERT_EQ(2u, addresses_.size()); |
| 158 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); | 159 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); |
| 159 EXPECT_EQ(expected, addresses_[0].ToString()); | 160 EXPECT_EQ(expected, addresses_[0].ToString()); |
| 160 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); | 161 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); |
| 161 EXPECT_EQ(expected, addresses_[1].ToString()); | 162 EXPECT_EQ(expected, addresses_[1].ToString()); |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace chromeos | 165 } // namespace chromeos |
| OLD | NEW |