OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/tracing/background_tracing_field_trial.h" | 13 #include "chrome/browser/tracing/background_tracing_field_trial.h" |
14 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
15 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
16 #include "chrome/common/chrome_switches.h" | |
17 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "components/metrics/metrics_pref_names.h" | 18 #include "components/metrics/metrics_pref_names.h" |
20 #include "components/prefs/pref_service.h" | 19 #include "components/prefs/pref_service.h" |
| 20 #include "components/variations/variations_switches.h" |
21 #include "content/public/browser/background_tracing_config.h" | 21 #include "content/public/browser/background_tracing_config.h" |
22 #include "content/public/browser/background_tracing_manager.h" | 22 #include "content/public/browser/background_tracing_manager.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/test/test_utils.h" | 24 #include "content/public/test/test_utils.h" |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 class ChromeTracingDelegateBrowserTest : public InProcessBrowserTest { | 28 class ChromeTracingDelegateBrowserTest : public InProcessBrowserTest { |
29 public: | 29 public: |
30 ChromeTracingDelegateBrowserTest() | 30 ChromeTracingDelegateBrowserTest() |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 "\"BENCHMARK\",\"configs\": [{\"rule\": " | 223 "\"BENCHMARK\",\"configs\": [{\"rule\": " |
224 "\"MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED\",\"trigger_name\":" | 224 "\"MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED\",\"trigger_name\":" |
225 "\"test\"}]}"; | 225 "\"test\"}]}"; |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 void SetUpCommandLine(base::CommandLine* command_line) override { | 229 void SetUpCommandLine(base::CommandLine* command_line) override { |
230 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 230 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
231 switches::kForceFieldTrials, "BackgroundTracing/TestGroup/"); | 231 switches::kForceFieldTrials, "BackgroundTracing/TestGroup/"); |
232 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 232 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
233 switches::kForceFieldTrialParams, | 233 variations::switches::kForceFieldTrialParams, |
234 "BackgroundTracing.TestGroup:config/default_config_for_testing"); | 234 "BackgroundTracing.TestGroup:config/default_config_for_testing"); |
235 | 235 |
236 tracing::SetConfigTextFilterForTesting(&FieldTrialConfigTextFilter); | 236 tracing::SetConfigTextFilterForTesting(&FieldTrialConfigTextFilter); |
237 } | 237 } |
238 }; | 238 }; |
239 | 239 |
240 #if !defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) | 240 #if !defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) |
241 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, | 241 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, |
242 PRE_ScenarioSetFromFieldtrial) { | 242 PRE_ScenarioSetFromFieldtrial) { |
243 // At this point the metrics pref is not set. | 243 // At this point the metrics pref is not set. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, | 277 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, |
278 StartupTracingThrottle) { | 278 StartupTracingThrottle) { |
279 // The startup scenario should *not* be started, since not enough | 279 // The startup scenario should *not* be started, since not enough |
280 // time has elapsed since the last upload (set in the PRE_ above). | 280 // time has elapsed since the last upload (set in the PRE_ above). |
281 EXPECT_FALSE( | 281 EXPECT_FALSE( |
282 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); | 282 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); |
283 } | 283 } |
284 | 284 |
285 } // namespace | 285 } // namespace |
OLD | NEW |