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

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

Issue 1996863002: media: Use bundled Widevine CDM in encrypted media browser tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 7 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
« no previous file with comments | « chrome/test/base/test_launcher_utils.h ('k') | no next file » | 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 <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #endif 65 #endif
66 66
67 #if defined(OS_MACOSX) 67 #if defined(OS_MACOSX)
68 // Use mock keychain on mac to prevent blocking permissions dialogs. 68 // Use mock keychain on mac to prevent blocking permissions dialogs.
69 command_line->AppendSwitch(os_crypt::switches::kUseMockKeychain); 69 command_line->AppendSwitch(os_crypt::switches::kUseMockKeychain);
70 #endif 70 #endif
71 71
72 command_line->AppendSwitch(switches::kDisableComponentUpdate); 72 command_line->AppendSwitch(switches::kDisableComponentUpdate);
73 } 73 }
74 74
75 void RemoveCommandLineSwitch(const base::CommandLine& in_command_line,
76 const std::string& switch_to_remove,
77 base::CommandLine* out_command_line) {
78 const base::CommandLine::SwitchMap& switch_map =
79 in_command_line.GetSwitches();
80 for (base::CommandLine::SwitchMap::const_iterator i = switch_map.begin();
81 i != switch_map.end(); ++i) {
82 const std::string& switch_name = i->first;
83 if (switch_name == switch_to_remove)
84 continue;
85
86 out_command_line->AppendSwitchNative(switch_name, i->second);
87 }
88 }
89
75 bool OverrideUserDataDir(const base::FilePath& user_data_dir) { 90 bool OverrideUserDataDir(const base::FilePath& user_data_dir) {
76 bool success = true; 91 bool success = true;
77 92
78 // PathService::Override() is the best way to change the user data directory. 93 // PathService::Override() is the best way to change the user data directory.
79 // This matches what is done in ChromeMain(). 94 // This matches what is done in ChromeMain().
80 success = PathService::Override(chrome::DIR_USER_DATA, user_data_dir); 95 success = PathService::Override(chrome::DIR_USER_DATA, user_data_dir);
81 96
82 #if defined(OS_POSIX) && !defined(OS_MACOSX) 97 #if defined(OS_POSIX) && !defined(OS_MACOSX)
83 // Make sure the cache directory is inside our clear profile. Otherwise 98 // Make sure the cache directory is inside our clear profile. Otherwise
84 // the cache may contain data from earlier tests that could break the 99 // the cache may contain data from earlier tests that could break the
85 // current test. 100 // current test.
86 // 101 //
87 // Note: we use an environment variable here, because we have to pass the 102 // Note: we use an environment variable here, because we have to pass the
88 // value to the child process. This is the simplest way to do it. 103 // value to the child process. This is the simplest way to do it.
89 std::unique_ptr<base::Environment> env(base::Environment::Create()); 104 std::unique_ptr<base::Environment> env(base::Environment::Create());
90 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value()); 105 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value());
91 #endif 106 #endif
92 107
93 return success; 108 return success;
94 } 109 }
95 110
96 } // namespace test_launcher_utils 111 } // namespace test_launcher_utils
OLDNEW
« no previous file with comments | « chrome/test/base/test_launcher_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698