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

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

Issue 2450993003: Componentize safe_browsing [1]: create component, move messages, constants and switches. (Closed)
Patch Set: fix compile Created 4 years 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
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"
11 #include "base/feature_list.h" 11 #include "base/feature_list.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "components/os_crypt/os_crypt_switches.h" 18 #include "components/os_crypt/os_crypt_switches.h"
19 #include "components/safe_browsing/common/safebrowsing_switches.h"
19 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
20 21
21 #if defined(USE_AURA) 22 #if defined(USE_AURA)
22 #include "ui/wm/core/wm_core_switches.h" 23 #include "ui/wm/core/wm_core_switches.h"
23 #endif 24 #endif
24 25
25 namespace test_launcher_utils { 26 namespace test_launcher_utils {
26 27
27 void PrepareBrowserCommandLineForTests(base::CommandLine* command_line) { 28 void PrepareBrowserCommandLineForTests(base::CommandLine* command_line) {
28 // Turn off preconnects because they break the brittle python webserver; 29 // Turn off preconnects because they break the brittle python webserver;
29 // see http://crbug.com/60035. 30 // see http://crbug.com/60035.
30 command_line->AppendSwitchASCII(switches::kDisableFeatures, 31 command_line->AppendSwitchASCII(switches::kDisableFeatures,
31 "NetworkPrediction"); 32 "NetworkPrediction");
32 33
33 // Don't show the first run ui. 34 // Don't show the first run ui.
34 command_line->AppendSwitch(switches::kNoFirstRun); 35 command_line->AppendSwitch(switches::kNoFirstRun);
35 36
36 // No default browser check, it would create an info-bar (if we are not the 37 // No default browser check, it would create an info-bar (if we are not the
37 // default browser) that could conflicts with some tests expectations. 38 // default browser) that could conflicts with some tests expectations.
38 command_line->AppendSwitch(switches::kNoDefaultBrowserCheck); 39 command_line->AppendSwitch(switches::kNoDefaultBrowserCheck);
39 40
40 // Enable info level logging to stderr by default so that we can see when 41 // Enable info level logging to stderr by default so that we can see when
41 // bad stuff happens, but honor the flags specified from the command line. 42 // bad stuff happens, but honor the flags specified from the command line.
42 if (!command_line->HasSwitch(switches::kEnableLogging)) 43 if (!command_line->HasSwitch(switches::kEnableLogging))
43 command_line->AppendSwitchASCII(switches::kEnableLogging, "stderr"); 44 command_line->AppendSwitchASCII(switches::kEnableLogging, "stderr");
44 if (!command_line->HasSwitch(switches::kLoggingLevel)) 45 if (!command_line->HasSwitch(switches::kLoggingLevel))
45 command_line->AppendSwitchASCII(switches::kLoggingLevel, "0"); // info 46 command_line->AppendSwitchASCII(switches::kLoggingLevel, "0"); // info
46 47
47 // Disable safebrowsing autoupdate. 48 // Disable safebrowsing autoupdate.
48 command_line->AppendSwitch(switches::kSbDisableAutoUpdate); 49 command_line->AppendSwitch(safe_browsing::switches::kSbDisableAutoUpdate);
49 50
50 // Don't install default apps. 51 // Don't install default apps.
51 command_line->AppendSwitch(switches::kDisableDefaultApps); 52 command_line->AppendSwitch(switches::kDisableDefaultApps);
52 53
53 #if defined(USE_AURA) 54 #if defined(USE_AURA)
54 // Disable window animations under Ash as the animations effect the 55 // Disable window animations under Ash as the animations effect the
55 // coordinates returned and result in flake. 56 // coordinates returned and result in flake.
56 command_line->AppendSwitch( 57 command_line->AppendSwitch(
57 wm::switches::kWindowAnimationsDisabled); 58 wm::switches::kWindowAnimationsDisabled);
58 #endif 59 #endif
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // Note: we use an environment variable here, because we have to pass the 105 // Note: we use an environment variable here, because we have to pass the
105 // value to the child process. This is the simplest way to do it. 106 // value to the child process. This is the simplest way to do it.
106 std::unique_ptr<base::Environment> env(base::Environment::Create()); 107 std::unique_ptr<base::Environment> env(base::Environment::Create());
107 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value()); 108 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value());
108 #endif 109 #endif
109 110
110 return success; 111 return success;
111 } 112 }
112 113
113 } // namespace test_launcher_utils 114 } // namespace test_launcher_utils
OLDNEW
« no previous file with comments | « chrome/renderer/safe_browsing/threat_dom_details_browsertest.cc ('k') | components/safe_browsing/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698