OLD | NEW |
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener { | 127 class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener { |
128 public: | 128 public: |
129 ChromeTestSuiteInitializer() { | 129 ChromeTestSuiteInitializer() { |
130 } | 130 } |
131 | 131 |
132 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { | 132 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { |
133 DCHECK(!g_browser_process); | 133 DCHECK(!g_browser_process); |
134 g_browser_process = new TestingBrowserProcess; | 134 g_browser_process = new TestingBrowserProcess; |
135 | 135 |
136 DCHECK(!content::GetContentClient()); | |
137 content_client_.reset(new chrome::ChromeContentClient); | 136 content_client_.reset(new chrome::ChromeContentClient); |
| 137 content::SetContentClient(content_client_.get()); |
138 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. | 138 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. |
139 #if !defined(OS_IOS) | 139 #if !defined(OS_IOS) |
140 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); | 140 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); |
141 content_client_->set_browser_for_testing(browser_content_client_.get()); | 141 SetBrowserClientForTesting(browser_content_client_.get()); |
142 #endif | 142 #endif |
143 content::SetContentClient(content_client_.get()); | |
144 | 143 |
145 SetUpHostResolver(); | 144 SetUpHostResolver(); |
146 } | 145 } |
147 | 146 |
148 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { | 147 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { |
149 if (g_browser_process) { | 148 if (g_browser_process) { |
150 delete g_browser_process; | 149 delete g_browser_process; |
151 g_browser_process = NULL; | 150 g_browser_process = NULL; |
152 } | 151 } |
153 | 152 |
154 DCHECK_EQ(content_client_.get(), content::GetContentClient()); | |
155 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. | 153 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. |
156 #if !defined(OS_IOS) | 154 #if !defined(OS_IOS) |
157 browser_content_client_.reset(); | 155 browser_content_client_.reset(); |
158 #endif | 156 #endif |
159 content_client_.reset(); | 157 content_client_.reset(); |
160 content::SetContentClient(NULL); | 158 content::SetContentClient(NULL); |
161 | 159 |
162 TearDownHostResolver(); | 160 TearDownHostResolver(); |
163 } | 161 } |
164 | 162 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 #if defined(OS_MACOSX) && !defined(OS_IOS) | 279 #if defined(OS_MACOSX) && !defined(OS_IOS) |
282 base::mac::SetOverrideFrameworkBundle(NULL); | 280 base::mac::SetOverrideFrameworkBundle(NULL); |
283 #endif | 281 #endif |
284 | 282 |
285 base::StatsTable::set_current(NULL); | 283 base::StatsTable::set_current(NULL); |
286 stats_table_.reset(); | 284 stats_table_.reset(); |
287 RemoveSharedMemoryFile(stats_filename_); | 285 RemoveSharedMemoryFile(stats_filename_); |
288 | 286 |
289 base::TestSuite::Shutdown(); | 287 base::TestSuite::Shutdown(); |
290 } | 288 } |
OLD | NEW |