| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 374 |
| 375 void BrowserTestBase::InitializeNetworkProcess() { | 375 void BrowserTestBase::InitializeNetworkProcess() { |
| 376 const testing::TestInfo* const test_info = | 376 const testing::TestInfo* const test_info = |
| 377 testing::UnitTest::GetInstance()->current_test_info(); | 377 testing::UnitTest::GetInstance()->current_test_info(); |
| 378 bool network_service = base::CommandLine::ForCurrentProcess()->HasSwitch( | 378 bool network_service = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 379 switches::kEnableNetworkService); | 379 switches::kEnableNetworkService); |
| 380 // ProcessTransferAfterError is the only browser test which needs to modify | 380 // ProcessTransferAfterError is the only browser test which needs to modify |
| 381 // the host rules (when not using the network service). | 381 // the host rules (when not using the network service). |
| 382 if (network_service || | 382 if (network_service || |
| 383 std::string(test_info->name()) != "ProcessTransferAfterError") { | 383 std::string(test_info->name()) != "ProcessTransferAfterError") { |
| 384 // TODO(jam): enable this once all access to host_resolver() is in | 384 host_resolver()->DisableModifications(); |
| 385 // SetUpOnMainThread or before. http://crbug.com/713847 | |
| 386 // host_resolver()->DisableModifications(); | |
| 387 } | 385 } |
| 388 | 386 |
| 389 if (!network_service) | 387 if (!network_service) |
| 390 return; | 388 return; |
| 391 | 389 |
| 392 net::RuleBasedHostResolverProc::RuleList rules = host_resolver()->GetRules(); | 390 net::RuleBasedHostResolverProc::RuleList rules = host_resolver()->GetRules(); |
| 393 std::vector<mojom::RulePtr> mojo_rules; | 391 std::vector<mojom::RulePtr> mojo_rules; |
| 394 for (const auto& rule : rules) { | 392 for (const auto& rule : rules) { |
| 395 // For now, this covers all the rules used in content's tests. | 393 // For now, this covers all the rules used in content's tests. |
| 396 // TODO(jam: expand this when we try to make browser_tests and | 394 // TODO(jam: expand this when we try to make browser_tests and |
| (...skipping 12 matching lines...) Expand all Loading... |
| 409 if (mojo_rules.empty()) | 407 if (mojo_rules.empty()) |
| 410 return; | 408 return; |
| 411 | 409 |
| 412 mojom::NetworkServiceTestPtr network_service_test; | 410 mojom::NetworkServiceTestPtr network_service_test; |
| 413 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( | 411 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( |
| 414 mojom::kNetworkServiceName, &network_service_test); | 412 mojom::kNetworkServiceName, &network_service_test); |
| 415 network_service_test->AddRules(std::move(mojo_rules)); | 413 network_service_test->AddRules(std::move(mojo_rules)); |
| 416 } | 414 } |
| 417 | 415 |
| 418 } // namespace content | 416 } // namespace content |
| OLD | NEW |