| 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 23 matching lines...) Expand all Loading... |
| 34 #include "content/public/test/test_launcher.h" | 34 #include "content/public/test/test_launcher.h" |
| 35 #include "content/public/test/test_utils.h" | 35 #include "content/public/test/test_utils.h" |
| 36 #include "content/test/content_browser_sanity_checker.h" | 36 #include "content/test/content_browser_sanity_checker.h" |
| 37 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" | 37 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" |
| 38 #include "net/dns/mock_host_resolver.h" | 38 #include "net/dns/mock_host_resolver.h" |
| 39 #include "net/test/embedded_test_server/embedded_test_server.h" | 39 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 40 #include "services/service_manager/public/cpp/connector.h" | 40 #include "services/service_manager/public/cpp/connector.h" |
| 41 #include "ui/base/platform_window_defaults.h" | 41 #include "ui/base/platform_window_defaults.h" |
| 42 #include "ui/base/test/material_design_controller_test_api.h" | 42 #include "ui/base/test/material_design_controller_test_api.h" |
| 43 #include "ui/compositor/compositor_switches.h" | 43 #include "ui/compositor/compositor_switches.h" |
| 44 #include "ui/gfx/color_space_switches.h" |
| 44 #include "ui/gl/gl_implementation.h" | 45 #include "ui/gl/gl_implementation.h" |
| 45 #include "ui/gl/gl_switches.h" | 46 #include "ui/gl/gl_switches.h" |
| 46 | 47 |
| 47 #if defined(OS_POSIX) | 48 #if defined(OS_POSIX) |
| 48 #include "base/process/process_handle.h" | 49 #include "base/process/process_handle.h" |
| 49 #endif | 50 #endif |
| 50 | 51 |
| 51 #if defined(OS_MACOSX) | 52 #if defined(OS_MACOSX) |
| 52 #include "base/mac/foundation_util.h" | 53 #include "base/mac/foundation_util.h" |
| 53 #endif | 54 #endif |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 #if defined(OS_CHROMEOS) | 218 #if defined(OS_CHROMEOS) |
| 218 // If the test is running on the chromeos envrionment (such as | 219 // If the test is running on the chromeos envrionment (such as |
| 219 // device or vm bots), we use hardware GL. | 220 // device or vm bots), we use hardware GL. |
| 220 if (base::SysInfo::IsRunningOnChromeOS()) | 221 if (base::SysInfo::IsRunningOnChromeOS()) |
| 221 use_software_gl = false; | 222 use_software_gl = false; |
| 222 #endif | 223 #endif |
| 223 | 224 |
| 224 if (use_software_gl && !use_software_compositing_) | 225 if (use_software_gl && !use_software_compositing_) |
| 225 command_line->AppendSwitch(switches::kOverrideUseSoftwareGLForTests); | 226 command_line->AppendSwitch(switches::kOverrideUseSoftwareGLForTests); |
| 226 | 227 |
| 228 // Use an sRGB color profile to ensure that the machine's color profile does |
| 229 // not affect the results. |
| 230 command_line->AppendSwitchASCII(switches::kForceColorProfile, "srgb"); |
| 231 |
| 227 test_host_resolver_ = base::MakeUnique<TestHostResolver>(); | 232 test_host_resolver_ = base::MakeUnique<TestHostResolver>(); |
| 228 | 233 |
| 229 ContentBrowserSanityChecker scoped_enable_sanity_checks; | 234 ContentBrowserSanityChecker scoped_enable_sanity_checks; |
| 230 | 235 |
| 231 SetUpInProcessBrowserTestFixture(); | 236 SetUpInProcessBrowserTestFixture(); |
| 232 | 237 |
| 233 // At this point, copy features to the command line, since BrowserMain will | 238 // At this point, copy features to the command line, since BrowserMain will |
| 234 // wipe out the current feature list. | 239 // wipe out the current feature list. |
| 235 std::string enabled_features; | 240 std::string enabled_features; |
| 236 std::string disabled_features; | 241 std::string disabled_features; |
| 237 if (base::FeatureList::GetInstance()) { | 242 if (base::FeatureList::GetInstance()) { |
| 238 base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features, | 243 base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features, |
| 239 &disabled_features); | 244 &disabled_features); |
| 240 } | 245 } |
| 246 |
| 241 if (!enabled_features.empty()) { | 247 if (!enabled_features.empty()) { |
| 242 command_line->AppendSwitchASCII(switches::kEnableFeatures, | 248 command_line->AppendSwitchASCII(switches::kEnableFeatures, |
| 243 enabled_features); | 249 enabled_features); |
| 244 } | 250 } |
| 245 if (!disabled_features.empty()) { | 251 if (!disabled_features.empty()) { |
| 246 command_line->AppendSwitchASCII(switches::kDisableFeatures, | 252 command_line->AppendSwitchASCII(switches::kDisableFeatures, |
| 247 disabled_features); | 253 disabled_features); |
| 248 } | 254 } |
| 249 | 255 |
| 250 // Need to wipe feature list clean, since BrowserMain calls | 256 // Need to wipe feature list clean, since BrowserMain calls |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 return; | 413 return; |
| 408 | 414 |
| 409 mojom::NetworkServiceTestPtr network_service_test; | 415 mojom::NetworkServiceTestPtr network_service_test; |
| 410 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( | 416 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( |
| 411 mojom::kNetworkServiceName, &network_service_test); | 417 mojom::kNetworkServiceName, &network_service_test); |
| 412 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call; | 418 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call; |
| 413 network_service_test->AddRules(std::move(mojo_rules)); | 419 network_service_test->AddRules(std::move(mojo_rules)); |
| 414 } | 420 } |
| 415 | 421 |
| 416 } // namespace content | 422 } // namespace content |
| OLD | NEW |