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

Side by Side Diff: chrome/test/base/chrome_test_suite.cc

Issue 10065040: RefCounted types should not have public destructors, chrome/ remaining parts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation fixes Created 8 years, 8 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
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 "chrome/test/base/chrome_test_suite.h" 5 #include "chrome/test/base/chrome_test_suite.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/metrics/stats_table.h" 10 #include "base/metrics/stats_table.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 memory.Delete(filename); 50 memory.Delete(filename);
51 #endif 51 #endif
52 } 52 }
53 53
54 // In many cases it may be not obvious that a test makes a real DNS lookup. 54 // In many cases it may be not obvious that a test makes a real DNS lookup.
55 // We generally don't want to rely on external DNS servers for our tests, 55 // We generally don't want to rely on external DNS servers for our tests,
56 // so this host resolver procedure catches external queries and returns a failed 56 // so this host resolver procedure catches external queries and returns a failed
57 // lookup result. 57 // lookup result.
58 class LocalHostResolverProc : public net::HostResolverProc { 58 class LocalHostResolverProc : public net::HostResolverProc {
59 public: 59 public:
60 LocalHostResolverProc() : HostResolverProc(NULL) { 60 LocalHostResolverProc() : HostResolverProc(NULL) {}
61 }
62 61
63 virtual int Resolve(const std::string& host, 62 virtual int Resolve(const std::string& host,
64 net::AddressFamily address_family, 63 net::AddressFamily address_family,
65 net::HostResolverFlags host_resolver_flags, 64 net::HostResolverFlags host_resolver_flags,
66 net::AddressList* addrlist, 65 net::AddressList* addrlist,
67 int* os_error) { 66 int* os_error) {
68 const char* kLocalHostNames[] = {"localhost", "127.0.0.1", "::1"}; 67 const char* kLocalHostNames[] = {"localhost", "127.0.0.1", "::1"};
69 bool local = false; 68 bool local = false;
70 69
71 if (host == net::GetHostName()) { 70 if (host == net::GetHostName()) {
(...skipping 13 matching lines...) Expand all
85 // net::RuleBasedHostResolverProc and its AllowDirectLookup method. 84 // net::RuleBasedHostResolverProc and its AllowDirectLookup method.
86 if (!local) { 85 if (!local) {
87 DVLOG(1) << "To avoid external dependencies, simulating failure for " 86 DVLOG(1) << "To avoid external dependencies, simulating failure for "
88 "external DNS lookup of " << host; 87 "external DNS lookup of " << host;
89 return net::ERR_NOT_IMPLEMENTED; 88 return net::ERR_NOT_IMPLEMENTED;
90 } 89 }
91 90
92 return ResolveUsingPrevious(host, address_family, host_resolver_flags, 91 return ResolveUsingPrevious(host, address_family, host_resolver_flags,
93 addrlist, os_error); 92 addrlist, os_error);
94 } 93 }
94
95 private:
96 virtual ~LocalHostResolverProc() {}
95 }; 97 };
96 98
97 class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener { 99 class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener {
98 public: 100 public:
99 ChromeTestSuiteInitializer() { 101 ChromeTestSuiteInitializer() {
100 } 102 }
101 103
102 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { 104 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE {
103 DCHECK(!g_browser_process); 105 DCHECK(!g_browser_process);
104 g_browser_process = new TestingBrowserProcess; 106 g_browser_process = new TestingBrowserProcess;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 #if defined(OS_MACOSX) 221 #if defined(OS_MACOSX)
220 base::mac::SetOverrideFrameworkBundle(NULL); 222 base::mac::SetOverrideFrameworkBundle(NULL);
221 #endif 223 #endif
222 224
223 base::StatsTable::set_current(NULL); 225 base::StatsTable::set_current(NULL);
224 stats_table_.reset(); 226 stats_table_.reset();
225 RemoveSharedMemoryFile(stats_filename_); 227 RemoveSharedMemoryFile(stats_filename_);
226 228
227 base::TestSuite::Shutdown(); 229 base::TestSuite::Shutdown();
228 } 230 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698