| 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 14 matching lines...) Expand all Loading... |
| 25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
| 27 #include "content/public/common/main_function_params.h" | 27 #include "content/public/common/main_function_params.h" |
| 28 #include "content/public/test/test_launcher.h" | 28 #include "content/public/test/test_launcher.h" |
| 29 #include "content/public/test/test_utils.h" | 29 #include "content/public/test/test_utils.h" |
| 30 #include "content/test/content_browser_sanity_checker.h" | 30 #include "content/test/content_browser_sanity_checker.h" |
| 31 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
| 32 #include "net/base/network_interfaces.h" | 32 #include "net/base/network_interfaces.h" |
| 33 #include "net/dns/mock_host_resolver.h" | 33 #include "net/dns/mock_host_resolver.h" |
| 34 #include "net/test/embedded_test_server/embedded_test_server.h" | 34 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 35 #include "ui/base/platform_window_defaults.h" |
| 35 #include "ui/base/test/material_design_controller_test_api.h" | 36 #include "ui/base/test/material_design_controller_test_api.h" |
| 36 #include "ui/compositor/compositor_switches.h" | 37 #include "ui/compositor/compositor_switches.h" |
| 37 #include "ui/gl/gl_implementation.h" | 38 #include "ui/gl/gl_implementation.h" |
| 38 #include "ui/gl/gl_switches.h" | 39 #include "ui/gl/gl_switches.h" |
| 39 | 40 |
| 40 #if defined(OS_POSIX) | 41 #if defined(OS_POSIX) |
| 41 #include "base/process/process_handle.h" | 42 #include "base/process/process_handle.h" |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 #if defined(OS_MACOSX) | 45 #if defined(OS_MACOSX) |
| 45 #include "base/mac/foundation_util.h" | 46 #include "base/mac/foundation_util.h" |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 48 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
| 49 #include "base/threading/thread_restrictions.h" | 50 #include "base/threading/thread_restrictions.h" |
| 50 #include "content/public/browser/browser_main_runner.h" | 51 #include "content/public/browser/browser_main_runner.h" |
| 51 #include "content/public/browser/browser_thread.h" | 52 #include "content/public/browser/browser_thread.h" |
| 52 #endif | 53 #endif |
| 53 | 54 |
| 54 #if defined(USE_AURA) | 55 #if defined(USE_AURA) |
| 55 #include "content/browser/compositor/image_transport_factory.h" | 56 #include "content/browser/compositor/image_transport_factory.h" |
| 56 #include "ui/aura/test/event_generator_delegate_aura.h" // nogncheck | 57 #include "ui/aura/test/event_generator_delegate_aura.h" // nogncheck |
| 57 #if defined(USE_X11) | |
| 58 #include "ui/aura/window_tree_host_x11.h" // nogncheck | |
| 59 #endif | |
| 60 #endif | 58 #endif |
| 61 | 59 |
| 62 namespace content { | 60 namespace content { |
| 63 namespace { | 61 namespace { |
| 64 | 62 |
| 65 #if defined(OS_POSIX) | 63 #if defined(OS_POSIX) |
| 66 // On SIGSEGV or SIGTERM (sent by the runner on timeouts), dump a stack trace | 64 // On SIGSEGV or SIGTERM (sent by the runner on timeouts), dump a stack trace |
| 67 // (to make debugging easier) and also exit with a known error code (so that | 65 // (to make debugging easier) and also exit with a known error code (so that |
| 68 // the test framework considers this a failure -- http://crbug.com/57578). | 66 // the test framework considers this a failure -- http://crbug.com/57578). |
| 69 // Note: We only want to do this in the browser process, and not forked | 67 // Note: We only want to do this in the browser process, and not forked |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 143 |
| 146 BrowserTestBase::BrowserTestBase() | 144 BrowserTestBase::BrowserTestBase() |
| 147 : expected_exit_code_(0), | 145 : expected_exit_code_(0), |
| 148 enable_pixel_output_(false), | 146 enable_pixel_output_(false), |
| 149 use_software_compositing_(false), | 147 use_software_compositing_(false), |
| 150 set_up_called_(false) { | 148 set_up_called_(false) { |
| 151 #if defined(OS_MACOSX) | 149 #if defined(OS_MACOSX) |
| 152 base::mac::SetOverrideAmIBundled(true); | 150 base::mac::SetOverrideAmIBundled(true); |
| 153 #endif | 151 #endif |
| 154 | 152 |
| 155 #if defined(USE_AURA) && defined(USE_X11) | 153 ui::test::SetUseOverrideRedirectWindowByDefault(true); |
| 156 aura::test::SetUseOverrideRedirectWindowByDefault(true); | |
| 157 #endif | |
| 158 | 154 |
| 159 #if defined(OS_POSIX) | 155 #if defined(OS_POSIX) |
| 160 handle_sigterm_ = true; | 156 handle_sigterm_ = true; |
| 161 #endif | 157 #endif |
| 162 | 158 |
| 163 // This is called through base::TestSuite initially. It'll also be called | 159 // This is called through base::TestSuite initially. It'll also be called |
| 164 // inside BrowserMain, so tell the code to ignore the check that it's being | 160 // inside BrowserMain, so tell the code to ignore the check that it's being |
| 165 // called more than once | 161 // called more than once |
| 166 base::i18n::AllowMultipleInitializeCallsForTesting(); | 162 base::i18n::AllowMultipleInitializeCallsForTesting(); |
| 167 | 163 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 use_software_compositing_ = true; | 399 use_software_compositing_ = true; |
| 404 } | 400 } |
| 405 | 401 |
| 406 bool BrowserTestBase::UsingOSMesa() const { | 402 bool BrowserTestBase::UsingOSMesa() const { |
| 407 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 403 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 408 return cmd->GetSwitchValueASCII(switches::kUseGL) == | 404 return cmd->GetSwitchValueASCII(switches::kUseGL) == |
| 409 gl::kGLImplementationOSMesaName; | 405 gl::kGLImplementationOSMesaName; |
| 410 } | 406 } |
| 411 | 407 |
| 412 } // namespace content | 408 } // namespace content |
| OLD | NEW |