| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/app_switches.h" |  | 
| 6 #include "app/gfx/gl/gl_implementation.h" |  | 
| 7 #include "base/command_line.h" | 5 #include "base/command_line.h" | 
| 8 #include "base/environment.h" | 6 #include "base/environment.h" | 
| 9 #include "base/path_service.h" | 7 #include "base/path_service.h" | 
| 10 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" | 
| 11 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" | 
| 12 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" | 
| 13 #include "chrome/test/test_launcher_utils.h" | 11 #include "chrome/test/test_launcher_utils.h" | 
| 14 | 12 | 
| 15 namespace test_launcher_utils { | 13 namespace test_launcher_utils { | 
| 16 | 14 | 
| 17 void PrepareBrowserCommandLineForTests(CommandLine* command_line) { | 15 void PrepareBrowserCommandLineForTests(CommandLine* command_line) { | 
| 18   // Turn off tip loading for tests; see http://crbug.com/17725. | 16   // Turn off tip loading for tests; see http://crbug.com/17725. | 
| 19   command_line->AppendSwitch(switches::kDisableWebResources); | 17   command_line->AppendSwitch(switches::kDisableWebResources); | 
| 20 | 18 | 
| 21   // Turn off preconnects because they break the brittle python webserver; | 19   // Turn off preconnects because they break the brittle python webserver; | 
| 22   // see http://crbug.com/60035. | 20   // see http://crbug.com/60035. | 
| 23   command_line->AppendSwitch(switches::kDisablePreconnect); | 21   command_line->AppendSwitch(switches::kDisablePreconnect); | 
| 24 | 22 | 
| 25   // Don't show the first run ui. | 23   // Don't show the first run ui. | 
| 26   command_line->AppendSwitch(switches::kNoFirstRun); | 24   command_line->AppendSwitch(switches::kNoFirstRun); | 
| 27 | 25 | 
| 28   // No default browser check, it would create an info-bar (if we are not the | 26   // No default browser check, it would create an info-bar (if we are not the | 
| 29   // default browser) that could conflicts with some tests expectations. | 27   // default browser) that could conflicts with some tests expectations. | 
| 30   command_line->AppendSwitch(switches::kNoDefaultBrowserCheck); | 28   command_line->AppendSwitch(switches::kNoDefaultBrowserCheck); | 
| 31 | 29 | 
| 32   // Enable warning level logging so that we can see when bad stuff happens. | 30   // Enable warning level logging so that we can see when bad stuff happens. | 
| 33   command_line->AppendSwitch(switches::kEnableLogging); | 31   command_line->AppendSwitch(switches::kEnableLogging); | 
| 34   command_line->AppendSwitchASCII(switches::kLoggingLevel, "1");  // warning | 32   command_line->AppendSwitchASCII(switches::kLoggingLevel, "1");  // warning | 
| 35 |  | 
| 36   // Force all tests to use OSMesa if they launch the GPU process. |  | 
| 37   command_line->AppendSwitchASCII(switches::kUseGL, |  | 
| 38                                   gfx::kGLImplementationOSMesaName); |  | 
| 39 |  | 
| 40   // Mac does not support accelerated compositing with OSMesa. |  | 
| 41   // http://crbug.com/58343 |  | 
| 42   command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |  | 
| 43 } | 33 } | 
| 44 | 34 | 
| 45 bool OverrideUserDataDir(const FilePath& user_data_dir) { | 35 bool OverrideUserDataDir(const FilePath& user_data_dir) { | 
| 46   bool success = true; | 36   bool success = true; | 
| 47 | 37 | 
| 48   // PathService::Override() is the best way to change the user data directory. | 38   // PathService::Override() is the best way to change the user data directory. | 
| 49   // This matches what is done in ChromeMain(). | 39   // This matches what is done in ChromeMain(). | 
| 50   success = PathService::Override(chrome::DIR_USER_DATA, user_data_dir); | 40   success = PathService::Override(chrome::DIR_USER_DATA, user_data_dir); | 
| 51 | 41 | 
| 52 #if defined(OS_LINUX) | 42 #if defined(OS_LINUX) | 
| 53   // Make sure the cache directory is inside our clear profile. Otherwise | 43   // Make sure the cache directory is inside our clear profile. Otherwise | 
| 54   // the cache may contain data from earlier tests that could break the | 44   // the cache may contain data from earlier tests that could break the | 
| 55   // current test. | 45   // current test. | 
| 56   // | 46   // | 
| 57   // Note: we use an environment variable here, because we have to pass the | 47   // Note: we use an environment variable here, because we have to pass the | 
| 58   // value to the child process. This is the simplest way to do it. | 48   // value to the child process. This is the simplest way to do it. | 
| 59   scoped_ptr<base::Environment> env(base::Environment::Create()); | 49   scoped_ptr<base::Environment> env(base::Environment::Create()); | 
| 60   success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value()); | 50   success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value()); | 
| 61 #endif | 51 #endif | 
| 62 | 52 | 
| 63   return success; | 53   return success; | 
| 64 } | 54 } | 
| 65 | 55 | 
| 66 }  // namespace test_launcher_utils | 56 }  // namespace test_launcher_utils | 
| OLD | NEW | 
|---|