| 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 "base/base_switches.h" | 5 #include "base/base_switches.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 switches::kForceFieldTrialParams, | 221 switches::kForceFieldTrialParams, |
| 222 "BackgroundTracing.TestGroup:config/default_config_for_testing"); | 222 "BackgroundTracing.TestGroup:config/default_config_for_testing"); |
| 223 | 223 |
| 224 tracing::SetConfigTextFilterForTesting(&FieldTrialConfigTextFilter); | 224 tracing::SetConfigTextFilterForTesting(&FieldTrialConfigTextFilter); |
| 225 } | 225 } |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, | 228 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, |
| 229 ScenarioSetFromFieldtrial) { | 229 ScenarioSetFromFieldtrial) { |
| 230 // We should reach this point without crashing. | 230 // We should reach this point without crashing. |
| 231 EXPECT_TRUE(content::BackgroundTracingManager::GetInstance() | 231 EXPECT_TRUE( |
| 232 ->HasActiveScenarioForTesting()); | 232 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, | 235 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, |
| 236 PRE_StartupTracingThrottle) { | 236 PRE_StartupTracingThrottle) { |
| 237 EXPECT_TRUE(content::BackgroundTracingManager::GetInstance() | 237 EXPECT_TRUE( |
| 238 ->HasActiveScenarioForTesting()); | 238 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); |
| 239 | 239 |
| 240 // Simulate a trace upload. | 240 // Simulate a trace upload. |
| 241 PrefService* local_state = g_browser_process->local_state(); | 241 PrefService* local_state = g_browser_process->local_state(); |
| 242 DCHECK(local_state); | 242 DCHECK(local_state); |
| 243 local_state->SetInt64(prefs::kBackgroundTracingLastUpload, | 243 local_state->SetInt64(prefs::kBackgroundTracingLastUpload, |
| 244 base::Time::Now().ToInternalValue()); | 244 base::Time::Now().ToInternalValue()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, | 247 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, |
| 248 StartupTracingThrottle) { | 248 StartupTracingThrottle) { |
| 249 // The startup scenario should *not* be started, since not enough | 249 // The startup scenario should *not* be started, since not enough |
| 250 // time has elapsed since the last upload (set in the PRE_ above). | 250 // time has elapsed since the last upload (set in the PRE_ above). |
| 251 EXPECT_FALSE(content::BackgroundTracingManager::GetInstance() | 251 EXPECT_FALSE( |
| 252 ->HasActiveScenarioForTesting()); | 252 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace | 255 } // namespace |
| OLD | NEW |