| 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" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // We move the last upload time to eight days in the past, | 174 // We move the last upload time to eight days in the past, |
| 175 // and at that point should be able to start a scenario again. | 175 // and at that point should be able to start a scenario again. |
| 176 base::Time new_upload_time = last_upload_time - base::TimeDelta::FromDays(8); | 176 base::Time new_upload_time = last_upload_time - base::TimeDelta::FromDays(8); |
| 177 local_state->SetInt64(prefs::kBackgroundTracingLastUpload, | 177 local_state->SetInt64(prefs::kBackgroundTracingLastUpload, |
| 178 new_upload_time.ToInternalValue()); | 178 new_upload_time.ToInternalValue()); |
| 179 EXPECT_TRUE(StartPreemptiveScenario( | 179 EXPECT_TRUE(StartPreemptiveScenario( |
| 180 base::Closure(), content::BackgroundTracingManager::NO_DATA_FILTERING)); | 180 base::Closure(), content::BackgroundTracingManager::NO_DATA_FILTERING)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) |
| 184 // Flaky on ASAN on Mac. See https://crbug.com/674497. |
| 185 #define MAYBE_ExistingIncognitoSessionBlockingTraceStart \ |
| 186 DISABLED_ExistingIncognitoSessionBlockingTraceStart |
| 187 #else |
| 188 #define MAYBE_ExistingIncognitoSessionBlockingTraceStart \ |
| 189 ExistingIncognitoSessionBlockingTraceStart |
| 190 #endif |
| 183 // If we need a PII-stripped trace, any existing OTR session should block the | 191 // If we need a PII-stripped trace, any existing OTR session should block the |
| 184 // trace. | 192 // trace. |
| 185 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest, | 193 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest, |
| 186 ExistingIncognitoSessionBlockingTraceStart) { | 194 MAYBE_ExistingIncognitoSessionBlockingTraceStart) { |
| 187 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_NEW_INCOGNITO_WINDOW)); | 195 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_NEW_INCOGNITO_WINDOW)); |
| 188 EXPECT_TRUE(BrowserList::IsIncognitoSessionActive()); | 196 EXPECT_TRUE(BrowserList::IsIncognitoSessionActive()); |
| 189 EXPECT_FALSE(StartPreemptiveScenario( | 197 EXPECT_FALSE(StartPreemptiveScenario( |
| 190 base::Closure(), content::BackgroundTracingManager::ANONYMIZE_DATA)); | 198 base::Closure(), content::BackgroundTracingManager::ANONYMIZE_DATA)); |
| 191 } | 199 } |
| 192 | 200 |
| 201 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) |
| 202 // Flaky on ASAN on Mac. See https://crbug.com/674497. |
| 203 #define MAYBE_NewIncognitoSessionBlockingTraceFinalization \ |
| 204 DISABLED_NewIncognitoSessionBlockingTraceFinalization |
| 205 #else |
| 206 #define MAYBE_NewIncognitoSessionBlockingTraceFinalization \ |
| 207 NewIncognitoSessionBlockingTraceFinalization |
| 208 #endif |
| 193 // If we need a PII-stripped trace, any new OTR session during tracing should | 209 // If we need a PII-stripped trace, any new OTR session during tracing should |
| 194 // block the finalization of the trace. | 210 // block the finalization of the trace. |
| 195 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest, | 211 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest, |
| 196 NewIncognitoSessionBlockingTraceFinalization) { | 212 MAYBE_NewIncognitoSessionBlockingTraceFinalization) { |
| 197 EXPECT_TRUE(StartPreemptiveScenario( | 213 EXPECT_TRUE(StartPreemptiveScenario( |
| 198 base::Closure(), content::BackgroundTracingManager::ANONYMIZE_DATA)); | 214 base::Closure(), content::BackgroundTracingManager::ANONYMIZE_DATA)); |
| 199 | 215 |
| 200 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_NEW_INCOGNITO_WINDOW)); | 216 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_NEW_INCOGNITO_WINDOW)); |
| 201 EXPECT_TRUE(BrowserList::IsIncognitoSessionActive()); | 217 EXPECT_TRUE(BrowserList::IsIncognitoSessionActive()); |
| 202 | 218 |
| 203 base::RunLoop wait_for_finalization_start; | 219 base::RunLoop wait_for_finalization_start; |
| 204 TriggerPreemptiveScenario(wait_for_finalization_start.QuitClosure()); | 220 TriggerPreemptiveScenario(wait_for_finalization_start.QuitClosure()); |
| 205 wait_for_finalization_start.Run(); | 221 wait_for_finalization_start.Run(); |
| 206 | 222 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 292 |
| 277 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, | 293 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, |
| 278 StartupTracingThrottle) { | 294 StartupTracingThrottle) { |
| 279 // The startup scenario should *not* be started, since not enough | 295 // The startup scenario should *not* be started, since not enough |
| 280 // time has elapsed since the last upload (set in the PRE_ above). | 296 // time has elapsed since the last upload (set in the PRE_ above). |
| 281 EXPECT_FALSE( | 297 EXPECT_FALSE( |
| 282 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); | 298 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); |
| 283 } | 299 } |
| 284 | 300 |
| 285 } // namespace | 301 } // namespace |
| OLD | NEW |