summaryrefslogtreecommitdiffstats
path: root/chrome/test/test_launcher_utils.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-29 22:56:14 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-29 22:56:14 +0000
commitaecb6caa6177e69648acc0ebe682283acb469cea (patch)
tree1a7c51d8ae8ad9672a31b3a61778f5438b400081 /chrome/test/test_launcher_utils.cc
parentbbbdc91b5f82da1726ed10c9da8b975a21ee9ffe (diff)
downloadchromium_src-aecb6caa6177e69648acc0ebe682283acb469cea.zip
chromium_src-aecb6caa6177e69648acc0ebe682283acb469cea.tar.gz
chromium_src-aecb6caa6177e69648acc0ebe682283acb469cea.tar.bz2
Move more files from chrome/test to chrome/test/base, part #3
BUG=90905 Review URL: http://codereview.chromium.org/7541001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/test_launcher_utils.cc')
-rw-r--r--chrome/test/test_launcher_utils.cc110
1 files changed, 0 insertions, 110 deletions
diff --git a/chrome/test/test_launcher_utils.cc b/chrome/test/test_launcher_utils.cc
deleted file mode 100644
index 37426a5..0000000
--- a/chrome/test/test_launcher_utils.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/command_line.h"
-#include "base/environment.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/path_service.h"
-#include "base/string_number_conversions.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/test/test_launcher_utils.h"
-#include "ui/gfx/gl/gl_switches.h"
-
-namespace {
-
-// A multiplier for slow tests. We generally avoid multiplying
-// test timeouts by any constants. Here it is used as last resort
-// to implement the SLOW_ test prefix.
-static const int kSlowTestTimeoutMultiplier = 5;
-
-} // namespace
-
-namespace test_launcher_utils {
-
-void PrepareBrowserCommandLineForTests(CommandLine* command_line) {
- // Turn off tip loading for tests; see http://crbug.com/17725.
- command_line->AppendSwitch(switches::kDisableWebResources);
-
- // Turn off preconnects because they break the brittle python webserver;
- // see http://crbug.com/60035.
- command_line->AppendSwitch(switches::kDisablePreconnect);
-
- // Don't show the first run ui.
- command_line->AppendSwitch(switches::kNoFirstRun);
-
- // No default browser check, it would create an info-bar (if we are not the
- // default browser) that could conflicts with some tests expectations.
- command_line->AppendSwitch(switches::kNoDefaultBrowserCheck);
-
- // Enable warning level logging so that we can see when bad stuff happens.
- command_line->AppendSwitch(switches::kEnableLogging);
- command_line->AppendSwitchASCII(switches::kLoggingLevel, "1"); // warning
-
- // Disable safebrowsing autoupdate.
- command_line->AppendSwitch(switches::kSbDisableAutoUpdate);
-
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
- // Don't use the native password stores on Linux since they may
- // prompt for additional UI during tests and cause test failures or
- // timeouts. Win, Mac and ChromeOS don't look at the kPasswordStore
- // switch.
- if (!command_line->HasSwitch(switches::kPasswordStore))
- command_line->AppendSwitchASCII(switches::kPasswordStore, "basic");
-#endif
-
-#if defined(OS_MACOSX)
- // Use mock keychain on mac to prevent blocking permissions dialogs.
- // TODO(sync): Re-enable when mock keyring works with sync integration tests.
- // See crbug.com/89808.
- // command_line->AppendSwitch(switches::kUseMockKeychain);
-#endif
-}
-
-bool OverrideUserDataDir(const FilePath& user_data_dir) {
- bool success = true;
-
- // PathService::Override() is the best way to change the user data directory.
- // This matches what is done in ChromeMain().
- success = PathService::Override(chrome::DIR_USER_DATA, user_data_dir);
-
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
- // Make sure the cache directory is inside our clear profile. Otherwise
- // the cache may contain data from earlier tests that could break the
- // current test.
- //
- // Note: we use an environment variable here, because we have to pass the
- // value to the child process. This is the simplest way to do it.
- scoped_ptr<base::Environment> env(base::Environment::Create());
- success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value());
-#endif
-
- return success;
-}
-
-bool OverrideGLImplementation(CommandLine* command_line,
- const std::string& implementation_name) {
- if (command_line->HasSwitch(switches::kUseGL))
- return false;
-
- command_line->AppendSwitchASCII(switches::kUseGL, implementation_name);
-
- return true;
-}
-
-int GetTestTerminationTimeout(const std::string& test_name,
- int default_timeout_ms) {
- int timeout_ms = default_timeout_ms;
-
- // Make it possible for selected tests to request a longer timeout.
- // Generally tests should really avoid doing too much, and splitting
- // a test instead of using SLOW prefix is strongly preferred.
- if (test_name.find("SLOW_") != std::string::npos)
- timeout_ms *= kSlowTestTimeoutMultiplier;
-
- return timeout_ms;
-}
-
-} // namespace test_launcher_utils