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/test_launcher_utils.h" | 5 #include "chrome/test/base/test_launcher_utils.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "content/public/test/test_launcher_utils.h" |
13 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
15 #include "ui/gl/gl_switches.h" | 16 #include "ui/gl/gl_switches.h" |
16 | 17 |
17 #if defined(USE_ASH) | 18 #if defined(USE_ASH) |
18 #include "ash/ash_switches.h" | 19 #include "ash/ash_switches.h" |
19 #endif | 20 #endif |
20 | 21 |
21 namespace test_launcher_utils { | 22 namespace test_launcher_utils { |
22 | 23 |
23 void PrepareBrowserCommandLineForTests(CommandLine* command_line) { | 24 void PrepareBrowserCommandLineForTests(CommandLine* command_line) { |
| 25 content::PrepareBrowserCommandLineForTests(command_line); |
| 26 |
24 // Turn off tip loading for tests; see http://crbug.com/17725. | 27 // Turn off tip loading for tests; see http://crbug.com/17725. |
25 command_line->AppendSwitch(switches::kDisableWebResources); | 28 command_line->AppendSwitch(switches::kDisableWebResources); |
26 | 29 |
27 // Turn off preconnects because they break the brittle python webserver; | 30 // Turn off preconnects because they break the brittle python webserver; |
28 // see http://crbug.com/60035. | 31 // see http://crbug.com/60035. |
29 command_line->AppendSwitch(switches::kDisablePreconnect); | 32 command_line->AppendSwitch(switches::kDisablePreconnect); |
30 | 33 |
31 // Turn off built-in asynchronous DNS client. | 34 // Turn off built-in asynchronous DNS client. |
32 command_line->AppendSwitch(switches::kDisableAsyncDns); | 35 command_line->AppendSwitch(switches::kDisableAsyncDns); |
33 | 36 |
34 // Don't show the first run ui. | 37 // Don't show the first run ui. |
35 command_line->AppendSwitch(switches::kNoFirstRun); | 38 command_line->AppendSwitch(switches::kNoFirstRun); |
36 | 39 |
37 // No default browser check, it would create an info-bar (if we are not the | 40 // No default browser check, it would create an info-bar (if we are not the |
38 // default browser) that could conflicts with some tests expectations. | 41 // default browser) that could conflicts with some tests expectations. |
39 command_line->AppendSwitch(switches::kNoDefaultBrowserCheck); | 42 command_line->AppendSwitch(switches::kNoDefaultBrowserCheck); |
40 | 43 |
41 // Enable warning level logging so that we can see when bad stuff happens. | |
42 command_line->AppendSwitch(switches::kEnableLogging); | |
43 command_line->AppendSwitchASCII(switches::kLoggingLevel, "1"); // warning | |
44 | |
45 // Disable safebrowsing autoupdate. | 44 // Disable safebrowsing autoupdate. |
46 command_line->AppendSwitch(switches::kSbDisableAutoUpdate); | 45 command_line->AppendSwitch(switches::kSbDisableAutoUpdate); |
47 | 46 |
48 // Don't install default apps. | 47 // Don't install default apps. |
49 command_line->AppendSwitch(switches::kDisableDefaultApps); | 48 command_line->AppendSwitch(switches::kDisableDefaultApps); |
50 | 49 |
51 // Don't collect GPU info, load GPU blacklist, or schedule a GPU blacklist | |
52 // auto-update. | |
53 command_line->AppendSwitch(switches::kSkipGpuDataLoading); | |
54 | |
55 #if defined(USE_ASH) | 50 #if defined(USE_ASH) |
56 // Disable window animations under Ash as the animations effect the | 51 // Disable window animations under Ash as the animations effect the |
57 // coordinates returned and result in flake. | 52 // coordinates returned and result in flake. |
58 command_line->AppendSwitch(ash::switches::kAshWindowAnimationsDisabled); | 53 command_line->AppendSwitch(ash::switches::kAshWindowAnimationsDisabled); |
59 #endif | 54 #endif |
60 | 55 |
61 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 56 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
62 // Don't use the native password stores on Linux since they may | 57 // Don't use the native password stores on Linux since they may |
63 // prompt for additional UI during tests and cause test failures or | 58 // prompt for additional UI during tests and cause test failures or |
64 // timeouts. Win, Mac and ChromeOS don't look at the kPasswordStore | 59 // timeouts. Win, Mac and ChromeOS don't look at the kPasswordStore |
(...skipping 24 matching lines...) Expand all Loading... |
89 // | 84 // |
90 // Note: we use an environment variable here, because we have to pass the | 85 // Note: we use an environment variable here, because we have to pass the |
91 // value to the child process. This is the simplest way to do it. | 86 // value to the child process. This is the simplest way to do it. |
92 scoped_ptr<base::Environment> env(base::Environment::Create()); | 87 scoped_ptr<base::Environment> env(base::Environment::Create()); |
93 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value()); | 88 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value()); |
94 #endif | 89 #endif |
95 | 90 |
96 return success; | 91 return success; |
97 } | 92 } |
98 | 93 |
99 bool OverrideGLImplementation(CommandLine* command_line, | |
100 const std::string& implementation_name) { | |
101 if (command_line->HasSwitch(switches::kUseGL)) | |
102 return false; | |
103 | |
104 command_line->AppendSwitchASCII(switches::kUseGL, implementation_name); | |
105 | |
106 return true; | |
107 } | |
108 | |
109 } // namespace test_launcher_utils | 94 } // namespace test_launcher_utils |
OLD | NEW |