OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
6 | 6 |
7 #include "ash/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #endif | 79 #endif |
80 | 80 |
81 #if defined(OS_CHROMEOS) | 81 #if defined(OS_CHROMEOS) |
82 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 82 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
83 #endif | 83 #endif |
84 | 84 |
85 #if defined(USE_ASH) | 85 #if defined(USE_ASH) |
86 #include "chrome/test/base/default_ash_event_generator_delegate.h" | 86 #include "chrome/test/base/default_ash_event_generator_delegate.h" |
87 #endif | 87 #endif |
88 | 88 |
| 89 #if !defined(OS_CHROMEOS) && defined(OS_LINUX) |
| 90 #include "ui/views/test/test_desktop_screen_x11.h" |
| 91 #endif |
| 92 |
89 namespace { | 93 namespace { |
90 | 94 |
91 // Passed as value of kTestType. | 95 // Passed as value of kTestType. |
92 const char kBrowserTestType[] = "browser"; | 96 const char kBrowserTestType[] = "browser"; |
93 | 97 |
94 } // namespace | 98 } // namespace |
95 | 99 |
96 // static | 100 // static |
97 InProcessBrowserTest::SetUpBrowserFunction* | 101 InProcessBrowserTest::SetUpBrowserFunction* |
98 InProcessBrowserTest::global_browser_set_up_function_ = nullptr; | 102 InProcessBrowserTest::global_browser_set_up_function_ = nullptr; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); | 219 base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); |
216 base::CreateDirectory(log_dir); | 220 base::CreateDirectory(log_dir); |
217 // Disable IME extension loading to avoid many browser tests failures. | 221 // Disable IME extension loading to avoid many browser tests failures. |
218 chromeos::input_method::DisableExtensionLoading(); | 222 chromeos::input_method::DisableExtensionLoading(); |
219 if (!command_line->HasSwitch(ash::switches::kAshHostWindowBounds)) { | 223 if (!command_line->HasSwitch(ash::switches::kAshHostWindowBounds)) { |
220 // Adjusting window location & size so that the ash desktop window fits | 224 // Adjusting window location & size so that the ash desktop window fits |
221 // inside the Xvfb'x defualt resolution. | 225 // inside the Xvfb'x defualt resolution. |
222 command_line->AppendSwitchASCII(ash::switches::kAshHostWindowBounds, | 226 command_line->AppendSwitchASCII(ash::switches::kAshHostWindowBounds, |
223 "0+0-1280x800"); | 227 "0+0-1280x800"); |
224 } | 228 } |
225 #endif // defined(OS_CHROMEOS) | 229 #elif defined(OS_LINUX) |
| 230 DCHECK(!display::Screen::GetScreen()); |
| 231 display::Screen::SetScreenInstance( |
| 232 views::test::TestDesktopScreenX11::GetInstance()); |
| 233 #endif |
226 | 234 |
227 // Always use a mocked password storage if OS encryption is used (which is | 235 // Always use a mocked password storage if OS encryption is used (which is |
228 // when anything sensitive gets stored, including Cookies). Without this on | 236 // when anything sensitive gets stored, including Cookies). Without this on |
229 // Mac, many tests will hang waiting for a user to approve KeyChain access. | 237 // Mac, many tests will hang waiting for a user to approve KeyChain access. |
230 OSCryptMocker::SetUpWithSingleton(); | 238 OSCryptMocker::SetUpWithSingleton(); |
231 | 239 |
232 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 240 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
233 CaptivePortalService::set_state_for_testing( | 241 CaptivePortalService::set_state_for_testing( |
234 CaptivePortalService::DISABLED_FOR_TESTING); | 242 CaptivePortalService::DISABLED_FOR_TESTING); |
235 #endif | 243 #endif |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 // On the Mac, this eventually reaches | 606 // On the Mac, this eventually reaches |
599 // -[BrowserWindowController windowWillClose:], which will post a deferred | 607 // -[BrowserWindowController windowWillClose:], which will post a deferred |
600 // -autorelease on itself to ultimately destroy the Browser object. The line | 608 // -autorelease on itself to ultimately destroy the Browser object. The line |
601 // below is necessary to pump these pending messages to ensure all Browsers | 609 // below is necessary to pump these pending messages to ensure all Browsers |
602 // get deleted. | 610 // get deleted. |
603 content::RunAllPendingInMessageLoop(); | 611 content::RunAllPendingInMessageLoop(); |
604 delete autorelease_pool_; | 612 delete autorelease_pool_; |
605 autorelease_pool_ = NULL; | 613 autorelease_pool_ = NULL; |
606 #endif | 614 #endif |
607 } | 615 } |
OLD | NEW |