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

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

Issue 11418005: Get a minimal unit_tests target building and running for iOS (Closed) Base URL: http://git.chromium.org/chromium/src.git@chrome-gyp-ios-support
Patch Set: Better ifdefing in chrome_paths Created 8 years, 1 month 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
« no previous file with comments | « chrome/common_constants.gyp ('k') | chrome/test/base/testing_browser_process.h » ('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 "chrome/test/base/chrome_test_suite.h" 5 #include "chrome/test/base/chrome_test_suite.h"
6 6
7 #if defined(OS_CHROMEOS) 7 #if defined(OS_CHROMEOS)
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 #endif 10 #endif
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 public: 124 public:
125 ChromeTestSuiteInitializer() { 125 ChromeTestSuiteInitializer() {
126 } 126 }
127 127
128 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { 128 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE {
129 DCHECK(!g_browser_process); 129 DCHECK(!g_browser_process);
130 g_browser_process = new TestingBrowserProcess; 130 g_browser_process = new TestingBrowserProcess;
131 131
132 DCHECK(!content::GetContentClient()); 132 DCHECK(!content::GetContentClient());
133 content_client_.reset(new chrome::ChromeContentClient); 133 content_client_.reset(new chrome::ChromeContentClient);
134 // TODO(ios): Bring this back once ChromeContentBrowserClient is building.
135 #if !defined(OS_IOS)
134 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); 136 browser_content_client_.reset(new chrome::ChromeContentBrowserClient());
135 content_client_->set_browser_for_testing(browser_content_client_.get()); 137 content_client_->set_browser_for_testing(browser_content_client_.get());
138 #endif
136 content::SetContentClient(content_client_.get()); 139 content::SetContentClient(content_client_.get());
137 140
138 SetUpHostResolver(); 141 SetUpHostResolver();
139 } 142 }
140 143
141 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { 144 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE {
142 if (g_browser_process) { 145 if (g_browser_process) {
143 delete g_browser_process; 146 delete g_browser_process;
144 g_browser_process = NULL; 147 g_browser_process = NULL;
145 } 148 }
146 149
147 DCHECK_EQ(content_client_.get(), content::GetContentClient()); 150 DCHECK_EQ(content_client_.get(), content::GetContentClient());
151 // TODO(ios): Bring this back once ChromeContentBrowserClient is building.
152 #if !defined(OS_IOS)
148 browser_content_client_.reset(); 153 browser_content_client_.reset();
154 #endif
149 content_client_.reset(); 155 content_client_.reset();
150 content::SetContentClient(NULL); 156 content::SetContentClient(NULL);
151 157
152 TearDownHostResolver(); 158 TearDownHostResolver();
153 } 159 }
154 160
155 private: 161 private:
156 void SetUpHostResolver() { 162 void SetUpHostResolver() {
157 host_resolver_proc_ = new LocalHostResolverProc; 163 host_resolver_proc_ = new LocalHostResolverProc;
158 scoped_host_resolver_proc_.reset( 164 scoped_host_resolver_proc_.reset(
159 new net::ScopedDefaultHostResolverProc(host_resolver_proc_.get())); 165 new net::ScopedDefaultHostResolverProc(host_resolver_proc_.get()));
160 } 166 }
161 167
162 void TearDownHostResolver() { 168 void TearDownHostResolver() {
163 scoped_host_resolver_proc_.reset(); 169 scoped_host_resolver_proc_.reset();
164 host_resolver_proc_ = NULL; 170 host_resolver_proc_ = NULL;
165 } 171 }
166 172
167 scoped_ptr<BrowserProcess> browser_process_; 173 scoped_ptr<BrowserProcess> browser_process_;
168 174
169 scoped_ptr<chrome::ChromeContentClient> content_client_; 175 scoped_ptr<chrome::ChromeContentClient> content_client_;
176 // TODO(ios): Bring this back once ChromeContentBrowserClient is building.
177 #if !defined(OS_IOS)
170 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_; 178 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_;
179 #endif
171 180
172 scoped_refptr<LocalHostResolverProc> host_resolver_proc_; 181 scoped_refptr<LocalHostResolverProc> host_resolver_proc_;
173 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_; 182 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_;
174 183
175 DISALLOW_COPY_AND_ASSIGN(ChromeTestSuiteInitializer); 184 DISALLOW_COPY_AND_ASSIGN(ChromeTestSuiteInitializer);
176 }; 185 };
177 186
178 } // namespace 187 } // namespace
179 188
180 ChromeTestSuite::ChromeTestSuite(int argc, char** argv) 189 ChromeTestSuite::ChromeTestSuite(int argc, char** argv)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 #if defined(OS_MACOSX) && !defined(OS_IOS) 262 #if defined(OS_MACOSX) && !defined(OS_IOS)
254 base::mac::SetOverrideFrameworkBundle(NULL); 263 base::mac::SetOverrideFrameworkBundle(NULL);
255 #endif 264 #endif
256 265
257 base::StatsTable::set_current(NULL); 266 base::StatsTable::set_current(NULL);
258 stats_table_.reset(); 267 stats_table_.reset();
259 RemoveSharedMemoryFile(stats_filename_); 268 RemoveSharedMemoryFile(stats_filename_);
260 269
261 base::TestSuite::Shutdown(); 270 base::TestSuite::Shutdown();
262 } 271 }
OLDNEW
« no previous file with comments | « chrome/common_constants.gyp ('k') | chrome/test/base/testing_browser_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698