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

Side by Side Diff: chromeos/network/host_resolver_impl_chromeos_unittest.cc

Issue 356933003: Reset host resolver in unittest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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 | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('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 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 "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 base::Bind(&HostResolverImplChromeOSTest::InitializeHostResolver, 61 base::Bind(&HostResolverImplChromeOSTest::InitializeHostResolver,
62 base::Unretained(this))); 62 base::Unretained(this)));
63 io_message_loop_.RunUntilIdle(); 63 io_message_loop_.RunUntilIdle();
64 64
65 // Run the main message loop to create the network observer and initialize 65 // Run the main message loop to create the network observer and initialize
66 // the ip address values. 66 // the ip address values.
67 base::RunLoop().RunUntilIdle(); 67 base::RunLoop().RunUntilIdle();
68 } 68 }
69 69
70 virtual void TearDown() OVERRIDE { 70 virtual void TearDown() OVERRIDE {
71 host_resolver_.reset();
71 network_state_handler_.reset(); 72 network_state_handler_.reset();
72 chromeos::DBusThreadManager::Shutdown(); 73 chromeos::DBusThreadManager::Shutdown();
73 } 74 }
74 75
75 protected: 76 protected:
76 // Run from main (UI) message loop, calls Resolve on IO message loop. 77 // Run from main (UI) message loop, calls Resolve on IO message loop.
77 int CallResolve(net::HostResolver::RequestInfo& info) { 78 int CallResolve(net::HostResolver::RequestInfo& info) {
78 io_message_loop_.PostTask( 79 io_message_loop_.PostTask(
79 FROM_HERE, 80 FROM_HERE,
80 base::Bind(&HostResolverImplChromeOSTest::Resolve, 81 base::Bind(&HostResolverImplChromeOSTest::Resolve,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 EXPECT_EQ(expected, addresses_[0].ToString()); 164 EXPECT_EQ(expected, addresses_[0].ToString());
164 165
165 info.set_address_family(net::ADDRESS_FAMILY_IPV6); 166 info.set_address_family(net::ADDRESS_FAMILY_IPV6);
166 EXPECT_EQ(net::OK, CallResolve(info)); 167 EXPECT_EQ(net::OK, CallResolve(info));
167 ASSERT_EQ(2u, addresses_.size()); 168 ASSERT_EQ(2u, addresses_.size());
168 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0); 169 expected = base::StringPrintf("[%s]:%d", kTestIPv6Address, 0);
169 EXPECT_EQ(expected, addresses_[0].ToString()); 170 EXPECT_EQ(expected, addresses_[0].ToString());
170 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0); 171 expected = base::StringPrintf("%s:%d", kTestIPv4Address, 0);
171 EXPECT_EQ(expected, addresses_[1].ToString()); 172 EXPECT_EQ(expected, addresses_[1].ToString());
172 } 173 }
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698