Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(805)

Side by Side Diff: chrome/test/base/test_launcher_utils.cc

Issue 176583002: [OS X] Wire up --use-mock-keychain command line flag to encryptor module (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix license header Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | components/encryptor.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "components/encryptor/encryptor_switches.h"
15 16
16 #if defined(USE_AURA) 17 #if defined(USE_AURA)
17 #include "ui/views/corewm/corewm_switches.h" 18 #include "ui/views/corewm/corewm_switches.h"
18 #endif 19 #endif
19 20
20 namespace test_launcher_utils { 21 namespace test_launcher_utils {
21 22
22 void PrepareBrowserCommandLineForTests(CommandLine* command_line) { 23 void PrepareBrowserCommandLineForTests(CommandLine* command_line) {
23 // Turn off tip loading for tests; see http://crbug.com/17725. 24 // Turn off tip loading for tests; see http://crbug.com/17725.
24 command_line->AppendSwitch(switches::kDisableWebResources); 25 command_line->AppendSwitch(switches::kDisableWebResources);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Don't use the native password stores on Linux since they may 59 // Don't use the native password stores on Linux since they may
59 // prompt for additional UI during tests and cause test failures or 60 // prompt for additional UI during tests and cause test failures or
60 // timeouts. Win, Mac and ChromeOS don't look at the kPasswordStore 61 // timeouts. Win, Mac and ChromeOS don't look at the kPasswordStore
61 // switch. 62 // switch.
62 if (!command_line->HasSwitch(switches::kPasswordStore)) 63 if (!command_line->HasSwitch(switches::kPasswordStore))
63 command_line->AppendSwitchASCII(switches::kPasswordStore, "basic"); 64 command_line->AppendSwitchASCII(switches::kPasswordStore, "basic");
64 #endif 65 #endif
65 66
66 #if defined(OS_MACOSX) 67 #if defined(OS_MACOSX)
67 // Use mock keychain on mac to prevent blocking permissions dialogs. 68 // Use mock keychain on mac to prevent blocking permissions dialogs.
68 command_line->AppendSwitch(switches::kUseMockKeychain); 69 command_line->AppendSwitch(encryptor::switches::kUseMockKeychain);
69 #endif 70 #endif
70 71
71 command_line->AppendSwitch(switches::kDisableComponentUpdate); 72 command_line->AppendSwitch(switches::kDisableComponentUpdate);
72 } 73 }
73 74
74 bool OverrideUserDataDir(const base::FilePath& user_data_dir) { 75 bool OverrideUserDataDir(const base::FilePath& user_data_dir) {
75 bool success = true; 76 bool success = true;
76 77
77 // PathService::Override() is the best way to change the user data directory. 78 // PathService::Override() is the best way to change the user data directory.
78 // This matches what is done in ChromeMain(). 79 // This matches what is done in ChromeMain().
79 success = PathService::Override(chrome::DIR_USER_DATA, user_data_dir); 80 success = PathService::Override(chrome::DIR_USER_DATA, user_data_dir);
80 81
81 #if defined(OS_POSIX) && !defined(OS_MACOSX) 82 #if defined(OS_POSIX) && !defined(OS_MACOSX)
82 // Make sure the cache directory is inside our clear profile. Otherwise 83 // Make sure the cache directory is inside our clear profile. Otherwise
83 // the cache may contain data from earlier tests that could break the 84 // the cache may contain data from earlier tests that could break the
84 // current test. 85 // current test.
85 // 86 //
86 // Note: we use an environment variable here, because we have to pass the 87 // Note: we use an environment variable here, because we have to pass the
87 // value to the child process. This is the simplest way to do it. 88 // value to the child process. This is the simplest way to do it.
88 scoped_ptr<base::Environment> env(base::Environment::Create()); 89 scoped_ptr<base::Environment> env(base::Environment::Create());
89 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value()); 90 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value());
90 #endif 91 #endif
91 92
92 return success; 93 return success;
93 } 94 }
94 95
95 } // namespace test_launcher_utils 96 } // namespace test_launcher_utils
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | components/encryptor.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698