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

Side by Side Diff: content/public/test/browser_test_base.cc

Issue 2960703003: Add a feature flag for network service and about:flags entry for it. (Closed)
Patch Set: merge Created 3 years, 5 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
« no previous file with comments | « content/public/common/content_switches.cc ('k') | content/renderer/render_frame_impl.cc » ('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) 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"
11 #include "base/debug/stack_trace.h" 11 #include "base/debug/stack_trace.h"
12 #include "base/feature_list.h" 12 #include "base/feature_list.h"
13 #include "base/i18n/icu_util.h" 13 #include "base/i18n/icu_util.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/sys_info.h" 20 #include "base/sys_info.h"
21 #include "base/test/test_timeouts.h" 21 #include "base/test/test_timeouts.h"
22 #include "base/threading/sequenced_worker_pool.h" 22 #include "base/threading/sequenced_worker_pool.h"
23 #include "base/threading/thread_restrictions.h" 23 #include "base/threading/thread_restrictions.h"
24 #include "build/build_config.h" 24 #include "build/build_config.h"
25 #include "content/browser/renderer_host/render_process_host_impl.h" 25 #include "content/browser/renderer_host/render_process_host_impl.h"
26 #include "content/browser/tracing/tracing_controller_impl.h" 26 #include "content/browser/tracing/tracing_controller_impl.h"
27 #include "content/public/app/content_main.h" 27 #include "content/public/app/content_main.h"
28 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
29 #include "content/public/common/content_features.h"
29 #include "content/public/common/content_switches.h" 30 #include "content/public/common/content_switches.h"
30 #include "content/public/common/main_function_params.h" 31 #include "content/public/common/main_function_params.h"
31 #include "content/public/common/network_service_test.mojom.h" 32 #include "content/public/common/network_service_test.mojom.h"
32 #include "content/public/common/service_manager_connection.h" 33 #include "content/public/common/service_manager_connection.h"
33 #include "content/public/common/service_names.mojom.h" 34 #include "content/public/common/service_names.mojom.h"
34 #include "content/public/test/test_launcher.h" 35 #include "content/public/test/test_launcher.h"
35 #include "content/public/test/test_utils.h" 36 #include "content/public/test/test_utils.h"
36 #include "content/test/content_browser_sanity_checker.h" 37 #include "content/test/content_browser_sanity_checker.h"
37 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" 38 #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
38 #include "net/dns/mock_host_resolver.h" 39 #include "net/dns/mock_host_resolver.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 374
374 bool BrowserTestBase::UsingSoftwareGL() const { 375 bool BrowserTestBase::UsingSoftwareGL() const {
375 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 376 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
376 return cmd->GetSwitchValueASCII(switches::kUseGL) == 377 return cmd->GetSwitchValueASCII(switches::kUseGL) ==
377 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation()); 378 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation());
378 } 379 }
379 380
380 void BrowserTestBase::InitializeNetworkProcess() { 381 void BrowserTestBase::InitializeNetworkProcess() {
381 const testing::TestInfo* const test_info = 382 const testing::TestInfo* const test_info =
382 testing::UnitTest::GetInstance()->current_test_info(); 383 testing::UnitTest::GetInstance()->current_test_info();
383 bool network_service = base::CommandLine::ForCurrentProcess()->HasSwitch( 384 bool network_service =
384 switches::kEnableNetworkService); 385 base::FeatureList::IsEnabled(features::kNetworkService);
385 // ProcessTransferAfterError is the only browser test which needs to modify 386 // ProcessTransferAfterError is the only browser test which needs to modify
386 // the host rules (when not using the network service). 387 // the host rules (when not using the network service).
387 if (network_service || 388 if (network_service ||
388 std::string(test_info->name()) != "ProcessTransferAfterError") { 389 std::string(test_info->name()) != "ProcessTransferAfterError") {
389 host_resolver()->DisableModifications(); 390 host_resolver()->DisableModifications();
390 } 391 }
391 392
392 if (!network_service) 393 if (!network_service)
393 return; 394 return;
394 395
(...skipping 18 matching lines...) Expand all
413 return; 414 return;
414 415
415 mojom::NetworkServiceTestPtr network_service_test; 416 mojom::NetworkServiceTestPtr network_service_test;
416 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( 417 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
417 mojom::kNetworkServiceName, &network_service_test); 418 mojom::kNetworkServiceName, &network_service_test);
418 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call; 419 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call;
419 network_service_test->AddRules(std::move(mojo_rules)); 420 network_service_test->AddRules(std::move(mojo_rules));
420 } 421 }
421 422
422 } // namespace content 423 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698