| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/public/test/browser_test_base.h" | 5 #include "content/public/test/browser_test_base.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 if (!enabled_features.empty()) | 243 if (!enabled_features.empty()) |
| 244 command_line->AppendSwitchASCII(switches::kEnableFeatures, | 244 command_line->AppendSwitchASCII(switches::kEnableFeatures, |
| 245 enabled_features); | 245 enabled_features); |
| 246 if (!disabled_features.empty()) | 246 if (!disabled_features.empty()) |
| 247 command_line->AppendSwitchASCII(switches::kDisableFeatures, | 247 command_line->AppendSwitchASCII(switches::kDisableFeatures, |
| 248 disabled_features); | 248 disabled_features); |
| 249 | 249 |
| 250 // Need to wipe feature list clean, since BrowserMain calls | 250 // Need to wipe feature list clean, since BrowserMain calls |
| 251 // FeatureList::SetInstance, which expects no instance to exist. | 251 // FeatureList::SetInstance, which expects no instance to exist. |
| 252 base::FeatureList::ClearInstanceForTesting(); | 252 base::FeatureList::ClearInstanceForTesting(); |
| 253 base::FeatureList::BlockOverridingInstanceForTesting(true); |
| 253 | 254 |
| 254 base::Closure* ui_task = | 255 base::Closure* ui_task = |
| 255 new base::Closure( | 256 new base::Closure( |
| 256 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, | 257 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, |
| 257 base::Unretained(this))); | 258 base::Unretained(this))); |
| 258 | 259 |
| 259 #if defined(OS_ANDROID) | 260 #if defined(OS_ANDROID) |
| 260 MainFunctionParams params(*command_line); | 261 MainFunctionParams params(*command_line); |
| 261 params.ui_task = ui_task; | 262 params.ui_task = ui_task; |
| 262 // TODO(phajdan.jr): Check return code, http://crbug.com/374738 . | 263 // TODO(phajdan.jr): Check return code, http://crbug.com/374738 . |
| 263 BrowserMain(params); | 264 BrowserMain(params); |
| 264 #else | 265 #else |
| 265 GetContentMainParams()->ui_task = ui_task; | 266 GetContentMainParams()->ui_task = ui_task; |
| 266 EXPECT_EQ(expected_exit_code_, ContentMain(*GetContentMainParams())); | 267 EXPECT_EQ(expected_exit_code_, ContentMain(*GetContentMainParams())); |
| 267 #endif | 268 #endif |
| 268 TearDownInProcessBrowserTestFixture(); | 269 TearDownInProcessBrowserTestFixture(); |
| 270 base::FeatureList::BlockOverridingInstanceForTesting(false); |
| 269 } | 271 } |
| 270 | 272 |
| 271 void BrowserTestBase::TearDown() { | 273 void BrowserTestBase::TearDown() { |
| 272 } | 274 } |
| 273 | 275 |
| 274 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { | 276 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { |
| 275 #if defined(OS_POSIX) | 277 #if defined(OS_POSIX) |
| 276 g_browser_process_pid = base::GetCurrentProcId(); | 278 g_browser_process_pid = base::GetCurrentProcId(); |
| 277 signal(SIGSEGV, DumpStackTraceSignalHandler); | 279 signal(SIGSEGV, DumpStackTraceSignalHandler); |
| 278 | 280 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 if (mojo_rules.empty()) | 410 if (mojo_rules.empty()) |
| 409 return; | 411 return; |
| 410 | 412 |
| 411 mojom::NetworkServiceTestPtr network_service_test; | 413 mojom::NetworkServiceTestPtr network_service_test; |
| 412 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( | 414 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( |
| 413 mojom::kNetworkServiceName, &network_service_test); | 415 mojom::kNetworkServiceName, &network_service_test); |
| 414 network_service_test->AddRules(std::move(mojo_rules)); | 416 network_service_test->AddRules(std::move(mojo_rules)); |
| 415 } | 417 } |
| 416 | 418 |
| 417 } // namespace content | 419 } // namespace content |
| OLD | NEW |