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

Side by Side Diff: content/browser/tracing/background_tracing_manager_browsertest.cc

Issue 2280073002: Mark more of BackgroundTracingManagerBrowserTest flaky (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | 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 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 <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 content::BackgroundTracingManager::GetInstance() 147 content::BackgroundTracingManager::GetInstance()
148 ->InvalidateTriggerHandlesForTesting(); 148 ->InvalidateTriggerHandlesForTesting();
149 } 149 }
150 150
151 void DisableScenarioWhenIdle() { 151 void DisableScenarioWhenIdle() {
152 BackgroundTracingManager::GetInstance()->SetActiveScenario( 152 BackgroundTracingManager::GetInstance()->SetActiveScenario(
153 NULL, BackgroundTracingManager::ReceiveCallback(), 153 NULL, BackgroundTracingManager::ReceiveCallback(),
154 BackgroundTracingManager::NO_DATA_FILTERING); 154 BackgroundTracingManager::NO_DATA_FILTERING);
155 } 155 }
156 156
157 #if defined(OS_ANDROID)
158 // Flaky on android: https://crbug.com/639706
159 #define MAYBE_ReceiveTraceFinalContentsOnTrigger \
160 DISABLED_ReceiveTraceFinalContentsOnTrigger
161 #else
162 #define MAYBE_ReceiveTraceFinalContentsOnTrigger \
163 ReceiveTraceFinalContentsOnTrigger
164 #endif
165
157 // This tests that the endpoint receives the final trace data. 166 // This tests that the endpoint receives the final trace data.
158 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 167 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
159 ReceiveTraceFinalContentsOnTrigger) { 168 MAYBE_ReceiveTraceFinalContentsOnTrigger) {
160 { 169 {
161 SetupBackgroundTracingManager(); 170 SetupBackgroundTracingManager();
162 171
163 base::RunLoop run_loop; 172 base::RunLoop run_loop;
164 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 173 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
165 run_loop.QuitClosure()); 174 run_loop.QuitClosure());
166 175
167 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig(); 176 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig();
168 177
169 BackgroundTracingManager::TriggerHandle handle = 178 BackgroundTracingManager::TriggerHandle handle =
170 BackgroundTracingManager:: 179 BackgroundTracingManager::
171 GetInstance()->RegisterTriggerType("preemptive_test"); 180 GetInstance()->RegisterTriggerType("preemptive_test");
172 181
173 EXPECT_TRUE(BackgroundTracingManager::GetInstance()->SetActiveScenario( 182 EXPECT_TRUE(BackgroundTracingManager::GetInstance()->SetActiveScenario(
174 std::move(config), upload_config_wrapper.get_receive_callback(), 183 std::move(config), upload_config_wrapper.get_receive_callback(),
175 BackgroundTracingManager::NO_DATA_FILTERING)); 184 BackgroundTracingManager::NO_DATA_FILTERING));
176 185
177 BackgroundTracingManager::GetInstance()->WhenIdle( 186 BackgroundTracingManager::GetInstance()->WhenIdle(
178 base::Bind(&DisableScenarioWhenIdle)); 187 base::Bind(&DisableScenarioWhenIdle));
179 188
180 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 189 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
181 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true)); 190 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true));
182 191
183 run_loop.Run(); 192 run_loop.Run();
184 193
185 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 194 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
186 } 195 }
187 } 196 }
188 197
198 #if defined(OS_ANDROID)
199 // Flaky on android: https://crbug.com/639706
200 #define MAYBE_CallTriggersMoreThanOnceOnlyGatherOnce \
201 DISABLED_CallTriggersMoreThanOnceOnlyGatherOnce
202 #else
203 #define MAYBE_CallTriggersMoreThanOnceOnlyGatherOnce \
204 CallTriggersMoreThanOnceOnlyGatherOnce
205 #endif
206
189 // This tests triggering more than once still only gathers once. 207 // This tests triggering more than once still only gathers once.
190 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 208 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
191 CallTriggersMoreThanOnceOnlyGatherOnce) { 209 MAYBE_CallTriggersMoreThanOnceOnlyGatherOnce) {
192 { 210 {
193 SetupBackgroundTracingManager(); 211 SetupBackgroundTracingManager();
194 212
195 base::RunLoop run_loop; 213 base::RunLoop run_loop;
196 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 214 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
197 run_loop.QuitClosure()); 215 run_loop.QuitClosure());
198 216
199 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig(); 217 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig();
200 218
201 content::BackgroundTracingManager::TriggerHandle handle = 219 content::BackgroundTracingManager::TriggerHandle handle =
(...skipping 27 matching lines...) Expand all
229 if (base::MatchPattern(category_group_name, "benchmark") && 247 if (base::MatchPattern(category_group_name, "benchmark") &&
230 base::MatchPattern(event_name, "whitelisted")) { 248 base::MatchPattern(event_name, "whitelisted")) {
231 return true; 249 return true;
232 } 250 }
233 251
234 return false; 252 return false;
235 } 253 }
236 254
237 } // namespace 255 } // namespace
238 256
257 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
258 // Flaky on android, chromeos: https://crbug.com/639706
259 #define MAYBE_NoWhitelistedArgsStripped DISABLED_NoWhitelistedArgsStripped
260 #else
261 #define MAYBE_NoWhitelistedArgsStripped NoWhitelistedArgsStripped
262 #endif
263
239 // This tests that non-whitelisted args get stripped if required. 264 // This tests that non-whitelisted args get stripped if required.
240 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 265 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
241 NoWhitelistedArgsStripped) { 266 MAYBE_NoWhitelistedArgsStripped) {
242 SetupBackgroundTracingManager(); 267 SetupBackgroundTracingManager();
243 268
244 base::trace_event::TraceLog::GetInstance()->SetArgumentFilterPredicate( 269 base::trace_event::TraceLog::GetInstance()->SetArgumentFilterPredicate(
245 base::Bind(&IsTraceEventArgsWhitelisted)); 270 base::Bind(&IsTraceEventArgsWhitelisted));
246 271
247 base::RunLoop wait_for_upload; 272 base::RunLoop wait_for_upload;
248 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 273 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
249 wait_for_upload.QuitClosure()); 274 wait_for_upload.QuitClosure());
250 275
251 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig(); 276 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig();
(...skipping 21 matching lines...) Expand all
273 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true)); 298 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true));
274 299
275 wait_for_upload.Run(); 300 wait_for_upload.Run();
276 301
277 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 302 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
278 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("{")); 303 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("{"));
279 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("find_this")); 304 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("find_this"));
280 EXPECT_FALSE(upload_config_wrapper.TraceHasMatchingString("this_not_found")); 305 EXPECT_FALSE(upload_config_wrapper.TraceHasMatchingString("this_not_found"));
281 } 306 }
282 307
308 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
309 // Flaky on android, chromeos: https://crbug.com/639706
310 #define MAYBE_TraceMetadataInTrace DISABLED_TraceMetadataInTrace
311 #else
312 #define MAYBE_TraceMetadataInTrace TraceMetadataInTrace
313 #endif
314
283 // This tests that browser metadata gets included in the trace. 315 // This tests that browser metadata gets included in the trace.
284 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 316 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
285 TraceMetadataInTrace) { 317 MAYBE_TraceMetadataInTrace) {
286 SetupBackgroundTracingManager(); 318 SetupBackgroundTracingManager();
287 319
288 base::trace_event::TraceLog::GetInstance()->SetArgumentFilterPredicate( 320 base::trace_event::TraceLog::GetInstance()->SetArgumentFilterPredicate(
289 base::Bind(&IsTraceEventArgsWhitelisted)); 321 base::Bind(&IsTraceEventArgsWhitelisted));
290 322
291 base::RunLoop wait_for_upload; 323 base::RunLoop wait_for_upload;
292 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 324 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
293 wait_for_upload.QuitClosure()); 325 wait_for_upload.QuitClosure());
294 326
295 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig(); 327 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig();
(...skipping 18 matching lines...) Expand all
314 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true)); 346 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true));
315 347
316 wait_for_upload.Run(); 348 wait_for_upload.Run();
317 349
318 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 350 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
319 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("cpu-brand")); 351 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("cpu-brand"));
320 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("network-type")); 352 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("network-type"));
321 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("user-agent")); 353 EXPECT_TRUE(upload_config_wrapper.TraceHasMatchingString("user-agent"));
322 } 354 }
323 355
324 #if defined(OS_ANDROID) 356 #if defined(OS_ANDROID) || defined(OS_LINUX)
325 // Flaky on android: https://crbug.com/639706 357 // Flaky on android: https://crbug.com/639706
358 // Flaky on android, linux: https://crbug.com/639706
326 #define MAYBE_CrashWhenSubprocessWithoutArgumentFilter \ 359 #define MAYBE_CrashWhenSubprocessWithoutArgumentFilter \
327 DISABLED_CrashWhenSubprocessWithoutArgumentFilter 360 DISABLED_CrashWhenSubprocessWithoutArgumentFilter
328 #else 361 #else
329 #define MAYBE_CrashWhenSubprocessWithoutArgumentFilter \ 362 #define MAYBE_CrashWhenSubprocessWithoutArgumentFilter \
330 CrashWhenSubprocessWithoutArgumentFilter 363 CrashWhenSubprocessWithoutArgumentFilter
331 #endif 364 #endif
332 365
333 // This tests subprocesses (like a navigating renderer) which gets told to 366 // This tests subprocesses (like a navigating renderer) which gets told to
334 // provide a argument-filtered trace and has no predicate in place to do the 367 // provide a argument-filtered trace and has no predicate in place to do the
335 // filtering (in this case, only the browser process gets it set), will crash 368 // filtering (in this case, only the browser process gets it set), will crash
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true)); 402 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true));
370 403
371 wait_for_upload.Run(); 404 wait_for_upload.Run();
372 405
373 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 406 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
374 // We should *not* receive anything at all from the renderer, 407 // We should *not* receive anything at all from the renderer,
375 // the process should've crashed rather than letting that happen. 408 // the process should've crashed rather than letting that happen.
376 EXPECT_TRUE(!upload_config_wrapper.TraceHasMatchingString("CrRendererMain")); 409 EXPECT_TRUE(!upload_config_wrapper.TraceHasMatchingString("CrRendererMain"));
377 } 410 }
378 411
412 #if defined(OS_ANDROID)
413 // Flaky on android: https://crbug.com/639706
414 #define MAYBE_CallMultipleTriggersOnlyGatherOnce \
415 DISABLED_CallMultipleTriggersOnlyGatherOnce
416 #else
417 #define MAYBE_CallMultipleTriggersOnlyGatherOnce \
418 CallMultipleTriggersOnlyGatherOnce
419 #endif
420
379 // This tests multiple triggers still only gathers once. 421 // This tests multiple triggers still only gathers once.
380 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 422 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
381 CallMultipleTriggersOnlyGatherOnce) { 423 MAYBE_CallMultipleTriggersOnlyGatherOnce) {
382 { 424 {
383 SetupBackgroundTracingManager(); 425 SetupBackgroundTracingManager();
384 426
385 base::RunLoop run_loop; 427 base::RunLoop run_loop;
386 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 428 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
387 run_loop.QuitClosure()); 429 run_loop.QuitClosure());
388 430
389 base::DictionaryValue dict; 431 base::DictionaryValue dict;
390 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); 432 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE");
391 dict.SetString("category", "BENCHMARK"); 433 dict.SetString("category", "BENCHMARK");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 471 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
430 handle2, 472 handle2,
431 base::Bind(&StartedFinalizingCallback, base::Closure(), false)); 473 base::Bind(&StartedFinalizingCallback, base::Closure(), false));
432 474
433 run_loop.Run(); 475 run_loop.Run();
434 476
435 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 477 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
436 } 478 }
437 } 479 }
438 480
481 #if defined(OS_ANDROID)
482 // Flaky on android: https://crbug.com/639706
483 #define MAYBE_ToggleBlinkScenarios DISABLED_ToggleBlinkScenarios
484 #else
485 #define MAYBE_ToggleBlinkScenarios ToggleBlinkScenarios
486 #endif
487
439 // This tests that toggling Blink scenarios in the config alters the 488 // This tests that toggling Blink scenarios in the config alters the
440 // command-line. 489 // command-line.
441 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 490 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
442 ToggleBlinkScenarios) { 491 MAYBE_ToggleBlinkScenarios) {
443 { 492 {
444 SetupBackgroundTracingManager(); 493 SetupBackgroundTracingManager();
445 494
446 base::RunLoop run_loop; 495 base::RunLoop run_loop;
447 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 496 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
448 run_loop.QuitClosure()); 497 run_loop.QuitClosure());
449 498
450 base::DictionaryValue dict; 499 base::DictionaryValue dict;
451 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); 500 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE");
452 dict.SetString("category", "BENCHMARK"); 501 dict.SetString("category", "BENCHMARK");
(...skipping 25 matching lines...) Expand all
478 EXPECT_TRUE(command_line); 527 EXPECT_TRUE(command_line);
479 528
480 EXPECT_EQ(command_line->GetSwitchValueASCII(switches::kEnableBlinkFeatures), 529 EXPECT_EQ(command_line->GetSwitchValueASCII(switches::kEnableBlinkFeatures),
481 "FasterWeb1,FasterWeb2"); 530 "FasterWeb1,FasterWeb2");
482 EXPECT_EQ( 531 EXPECT_EQ(
483 command_line->GetSwitchValueASCII(switches::kDisableBlinkFeatures), 532 command_line->GetSwitchValueASCII(switches::kDisableBlinkFeatures),
484 "SlowerWeb1,SlowerWeb2"); 533 "SlowerWeb1,SlowerWeb2");
485 } 534 }
486 } 535 }
487 536
537 #if defined(OS_ANDROID)
538 // Flaky on android: https://crbug.com/639706
539 #define MAYBE_ToggleBlinkScenariosNotOverridingSwitches \
540 DISABLED_ToggleBlinkScenariosNotOverridingSwitches
541 #else
542 #define MAYBE_ToggleBlinkScenariosNotOverridingSwitches \
543 ToggleBlinkScenariosNotOverridingSwitches
544 #endif
545
488 // This tests that toggling Blink scenarios in a scenario won't activate 546 // This tests that toggling Blink scenarios in a scenario won't activate
489 // if there's already Blink features toggled by something else (about://flags) 547 // if there's already Blink features toggled by something else (about://flags)
490 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 548 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
491 ToggleBlinkScenariosNotOverridingSwitches) { 549 MAYBE_ToggleBlinkScenariosNotOverridingSwitches) {
492 SetupBackgroundTracingManager(); 550 SetupBackgroundTracingManager();
493 551
494 base::RunLoop run_loop; 552 base::RunLoop run_loop;
495 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 553 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
496 run_loop.QuitClosure()); 554 run_loop.QuitClosure());
497 555
498 base::DictionaryValue dict; 556 base::DictionaryValue dict;
499 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); 557 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE");
500 dict.SetString("category", "BENCHMARK"); 558 dict.SetString("category", "BENCHMARK");
501 559
(...skipping 17 matching lines...) Expand all
519 switches::kEnableBlinkFeatures, "FooFeature"); 577 switches::kEnableBlinkFeatures, "FooFeature");
520 578
521 bool scenario_activated = 579 bool scenario_activated =
522 BackgroundTracingManager::GetInstance()->SetActiveScenario( 580 BackgroundTracingManager::GetInstance()->SetActiveScenario(
523 std::move(config), upload_config_wrapper.get_receive_callback(), 581 std::move(config), upload_config_wrapper.get_receive_callback(),
524 BackgroundTracingManager::NO_DATA_FILTERING); 582 BackgroundTracingManager::NO_DATA_FILTERING);
525 583
526 EXPECT_FALSE(scenario_activated); 584 EXPECT_FALSE(scenario_activated);
527 } 585 }
528 586
587 #if defined(OS_ANDROID)
588 // Flaky on android: https://crbug.com/639706
589 #define MAYBE_CallPreemptiveTriggerWithDelay \
590 DISABLED_CallPreemptiveTriggerWithDelay
591 #else
592 #define MAYBE_CallPreemptiveTriggerWithDelay CallPreemptiveTriggerWithDelay
593 #endif
594
529 // This tests that delayed histogram triggers triggers work as expected 595 // This tests that delayed histogram triggers triggers work as expected
530 // with preemptive scenarios. 596 // with preemptive scenarios.
531 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 597 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
532 CallPreemptiveTriggerWithDelay) { 598 MAYBE_CallPreemptiveTriggerWithDelay) {
533 { 599 {
534 SetupBackgroundTracingManager(); 600 SetupBackgroundTracingManager();
535 601
536 base::RunLoop run_loop; 602 base::RunLoop run_loop;
537 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 603 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
538 run_loop.QuitClosure()); 604 run_loop.QuitClosure());
539 605
540 base::DictionaryValue dict; 606 base::DictionaryValue dict;
541 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); 607 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE");
542 dict.SetString("category", "BENCHMARK"); 608 dict.SetString("category", "BENCHMARK");
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 BackgroundTracingManagerImpl::GetInstance()->FireTimerForTesting(); 651 BackgroundTracingManagerImpl::GetInstance()->FireTimerForTesting();
586 EXPECT_FALSE( 652 EXPECT_FALSE(
587 BackgroundTracingManagerImpl::GetInstance()->IsTracingForTesting()); 653 BackgroundTracingManagerImpl::GetInstance()->IsTracingForTesting());
588 654
589 run_loop.Run(); 655 run_loop.Run();
590 656
591 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 657 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
592 } 658 }
593 } 659 }
594 660
661 #if defined(OS_ANDROID)
662 // Flaky on android: https://crbug.com/639706
663 #define MAYBE_CannotTriggerWithoutScenarioSet \
664 DISABLED_CannotTriggerWithoutScenarioSet
665 #else
666 #define MAYBE_CannotTriggerWithoutScenarioSet CannotTriggerWithoutScenarioSet
667 #endif
668
595 // This tests that you can't trigger without a scenario set. 669 // This tests that you can't trigger without a scenario set.
596 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 670 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
597 CannotTriggerWithoutScenarioSet) { 671 MAYBE_CannotTriggerWithoutScenarioSet) {
598 { 672 {
599 SetupBackgroundTracingManager(); 673 SetupBackgroundTracingManager();
600 674
601 base::RunLoop run_loop; 675 base::RunLoop run_loop;
602 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 676 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
603 (base::Closure())); 677 (base::Closure()));
604 678
605 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig(); 679 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig();
606 680
607 content::BackgroundTracingManager::TriggerHandle handle = 681 content::BackgroundTracingManager::TriggerHandle handle =
608 content::BackgroundTracingManager::GetInstance()->RegisterTriggerType( 682 content::BackgroundTracingManager::GetInstance()->RegisterTriggerType(
609 "preemptive_test"); 683 "preemptive_test");
610 684
611 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 685 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
612 handle, 686 handle,
613 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false)); 687 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false));
614 688
615 run_loop.Run(); 689 run_loop.Run();
616 690
617 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0); 691 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0);
618 } 692 }
619 } 693 }
620 694
695 #if defined(OS_ANDROID)
696 // Flaky on android: https://crbug.com/639706
697 #define MAYBE_DoesNotTriggerWithWrongHandle \
698 DISABLED_DoesNotTriggerWithWrongHandle
699 #else
700 #define MAYBE_DoesNotTriggerWithWrongHandle DoesNotTriggerWithWrongHandle
701 #endif
702
621 // This tests that no trace is triggered with a handle that isn't specified 703 // This tests that no trace is triggered with a handle that isn't specified
622 // in the config. 704 // in the config.
623 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 705 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
624 DoesNotTriggerWithWrongHandle) { 706 MAYBE_DoesNotTriggerWithWrongHandle) {
625 { 707 {
626 SetupBackgroundTracingManager(); 708 SetupBackgroundTracingManager();
627 709
628 base::RunLoop run_loop; 710 base::RunLoop run_loop;
629 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 711 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
630 (base::Closure())); 712 (base::Closure()));
631 713
632 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig(); 714 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig();
633 715
634 content::BackgroundTracingManager::TriggerHandle handle = 716 content::BackgroundTracingManager::TriggerHandle handle =
(...skipping 10 matching lines...) Expand all
645 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 727 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
646 handle, 728 handle,
647 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false)); 729 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false));
648 730
649 run_loop.Run(); 731 run_loop.Run();
650 732
651 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0); 733 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0);
652 } 734 }
653 } 735 }
654 736
737 #if defined(OS_ANDROID)
738 // Flaky on android: https://crbug.com/639706
739 #define MAYBE_DoesNotTriggerWithInvalidHandle \
740 DISABLED_DoesNotTriggerWithInvalidHandle
741 #else
742 #define MAYBE_DoesNotTriggerWithInvalidHandle DoesNotTriggerWithInvalidHandle
743 #endif
744
655 // This tests that no trace is triggered with an invalid handle. 745 // This tests that no trace is triggered with an invalid handle.
656 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 746 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
657 DoesNotTriggerWithInvalidHandle) { 747 MAYBE_DoesNotTriggerWithInvalidHandle) {
658 { 748 {
659 SetupBackgroundTracingManager(); 749 SetupBackgroundTracingManager();
660 750
661 base::RunLoop run_loop; 751 base::RunLoop run_loop;
662 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 752 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
663 (base::Closure())); 753 (base::Closure()));
664 754
665 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig(); 755 std::unique_ptr<BackgroundTracingConfig> config = CreatePreemptiveConfig();
666 756
667 content::BackgroundTracingManager::TriggerHandle handle = 757 content::BackgroundTracingManager::TriggerHandle handle =
(...skipping 13 matching lines...) Expand all
681 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 771 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
682 handle, 772 handle,
683 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false)); 773 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false));
684 774
685 run_loop.Run(); 775 run_loop.Run();
686 776
687 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0); 777 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0);
688 } 778 }
689 } 779 }
690 780
781 #if defined(OS_ANDROID)
782 // Flaky on android: https://crbug.com/639706
783 #define MAYBE_PreemptiveNotTriggerWithZeroChance \
784 DISABLED_PreemptiveNotTriggerWithZeroChance
785 #else
786 #define MAYBE_PreemptiveNotTriggerWithZeroChance \
787 PreemptiveNotTriggerWithZeroChance
788 #endif
789
691 // This tests that no preemptive trace is triggered with 0 chance set. 790 // This tests that no preemptive trace is triggered with 0 chance set.
692 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 791 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
693 PreemptiveNotTriggerWithZeroChance) { 792 MAYBE_PreemptiveNotTriggerWithZeroChance) {
694 { 793 {
695 SetupBackgroundTracingManager(); 794 SetupBackgroundTracingManager();
696 795
697 base::RunLoop run_loop; 796 base::RunLoop run_loop;
698 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 797 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
699 (base::Closure())); 798 (base::Closure()));
700 799
701 base::DictionaryValue dict; 800 base::DictionaryValue dict;
702 801
703 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); 802 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE");
(...skipping 29 matching lines...) Expand all
733 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 832 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
734 handle, 833 handle,
735 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false)); 834 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false));
736 835
737 run_loop.Run(); 836 run_loop.Run();
738 837
739 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0); 838 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0);
740 } 839 }
741 } 840 }
742 841
842 #if defined(OS_ANDROID)
843 // Flaky on android: https://crbug.com/639706
844 #define MAYBE_ReactiveNotTriggerWithZeroChance \
845 DISABLED_ReactiveNotTriggerWithZeroChance
846 #else
847 #define MAYBE_ReactiveNotTriggerWithZeroChance ReactiveNotTriggerWithZeroChance
848 #endif
849
743 // This tests that no reactive trace is triggered with 0 chance set. 850 // This tests that no reactive trace is triggered with 0 chance set.
744 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 851 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
745 ReactiveNotTriggerWithZeroChance) { 852 MAYBE_ReactiveNotTriggerWithZeroChance) {
746 { 853 {
747 SetupBackgroundTracingManager(); 854 SetupBackgroundTracingManager();
748 855
749 base::RunLoop run_loop; 856 base::RunLoop run_loop;
750 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 857 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
751 (base::Closure())); 858 (base::Closure()));
752 859
753 base::DictionaryValue dict; 860 base::DictionaryValue dict;
754 861
755 dict.SetString("mode", "REACTIVE_TRACING_MODE"); 862 dict.SetString("mode", "REACTIVE_TRACING_MODE");
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 894 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
788 handle, 895 handle,
789 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false)); 896 base::Bind(&StartedFinalizingCallback, run_loop.QuitClosure(), false));
790 897
791 run_loop.Run(); 898 run_loop.Run();
792 899
793 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0); 900 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0);
794 } 901 }
795 } 902 }
796 903
904 #if defined(OS_ANDROID)
905 // Flaky on android: https://crbug.com/639706
906 #define MAYBE_ReceiveTraceSucceedsOnHigherHistogramSample \
907 DISABLED_ReceiveTraceSucceedsOnHigherHistogramSample
908 #else
909 #define MAYBE_ReceiveTraceSucceedsOnHigherHistogramSample \
910 ReceiveTraceSucceedsOnHigherHistogramSample
911 #endif
912
797 // This tests that histogram triggers for preemptive mode configs. 913 // This tests that histogram triggers for preemptive mode configs.
798 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 914 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
799 ReceiveTraceSucceedsOnHigherHistogramSample) { 915 MAYBE_ReceiveTraceSucceedsOnHigherHistogramSample) {
800 { 916 {
801 SetupBackgroundTracingManager(); 917 SetupBackgroundTracingManager();
802 918
803 base::RunLoop run_loop; 919 base::RunLoop run_loop;
804 920
805 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 921 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
806 run_loop.QuitClosure()); 922 run_loop.QuitClosure());
807 923
808 base::DictionaryValue dict; 924 base::DictionaryValue dict;
809 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); 925 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE");
(...skipping 25 matching lines...) Expand all
835 951
836 // Our reference value is "1", so a value of "2" should trigger a trace. 952 // Our reference value is "1", so a value of "2" should trigger a trace.
837 LOCAL_HISTOGRAM_COUNTS("fake", 2); 953 LOCAL_HISTOGRAM_COUNTS("fake", 2);
838 954
839 run_loop.Run(); 955 run_loop.Run();
840 956
841 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 957 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
842 } 958 }
843 } 959 }
844 960
961 #if defined(OS_ANDROID)
962 // Flaky on android: https://crbug.com/639706
963 #define MAYBE_ReceiveReactiveTraceSucceedsOnHigherHistogramSample \
964 DISABLED_ReceiveReactiveTraceSucceedsOnHigherHistogramSample
965 #else
966 #define MAYBE_ReceiveReactiveTraceSucceedsOnHigherHistogramSample \
967 ReceiveReactiveTraceSucceedsOnHigherHistogramSample
968 #endif
969
845 // This tests that histogram triggers for reactive mode configs. 970 // This tests that histogram triggers for reactive mode configs.
846 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 971 IN_PROC_BROWSER_TEST_F(
847 ReceiveReactiveTraceSucceedsOnHigherHistogramSample) { 972 BackgroundTracingManagerBrowserTest,
973 MAYBE_ReceiveReactiveTraceSucceedsOnHigherHistogramSample) {
848 { 974 {
849 SetupBackgroundTracingManager(); 975 SetupBackgroundTracingManager();
850 976
851 base::RunLoop run_loop; 977 base::RunLoop run_loop;
852 978
853 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 979 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
854 run_loop.QuitClosure()); 980 run_loop.QuitClosure());
855 981
856 base::DictionaryValue dict; 982 base::DictionaryValue dict;
857 dict.SetString("mode", "REACTIVE_TRACING_MODE"); 983 dict.SetString("mode", "REACTIVE_TRACING_MODE");
(...skipping 25 matching lines...) Expand all
883 1009
884 // Our reference value is "1", so a value of "2" should trigger a trace. 1010 // Our reference value is "1", so a value of "2" should trigger a trace.
885 LOCAL_HISTOGRAM_COUNTS("fake", 2); 1011 LOCAL_HISTOGRAM_COUNTS("fake", 2);
886 1012
887 run_loop.Run(); 1013 run_loop.Run();
888 1014
889 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 1015 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
890 } 1016 }
891 } 1017 }
892 1018
1019 #if defined(OS_ANDROID)
1020 // Flaky on android: https://crbug.com/639706
1021 #define MAYBE_ReceiveTraceFailsOnLowerHistogramSample \
1022 DISABLED_ReceiveTraceFailsOnLowerHistogramSample
1023 #else
1024 #define MAYBE_ReceiveTraceFailsOnLowerHistogramSample \
1025 ReceiveTraceFailsOnLowerHistogramSample
1026 #endif
1027
893 // This tests that histogram values < reference value don't trigger. 1028 // This tests that histogram values < reference value don't trigger.
894 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 1029 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
895 ReceiveTraceFailsOnLowerHistogramSample) { 1030 MAYBE_ReceiveTraceFailsOnLowerHistogramSample) {
896 { 1031 {
897 SetupBackgroundTracingManager(); 1032 SetupBackgroundTracingManager();
898 1033
899 base::RunLoop run_loop; 1034 base::RunLoop run_loop;
900 1035
901 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 1036 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
902 run_loop.QuitClosure()); 1037 run_loop.QuitClosure());
903 1038
904 base::DictionaryValue dict; 1039 base::DictionaryValue dict;
905 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); 1040 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE");
(...skipping 26 matching lines...) Expand all
932 // This should fail to trigger a trace since the sample value < the 1067 // This should fail to trigger a trace since the sample value < the
933 // the reference value above. 1068 // the reference value above.
934 LOCAL_HISTOGRAM_COUNTS("fake", 0); 1069 LOCAL_HISTOGRAM_COUNTS("fake", 0);
935 1070
936 run_loop.RunUntilIdle(); 1071 run_loop.RunUntilIdle();
937 1072
938 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0); 1073 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0);
939 } 1074 }
940 } 1075 }
941 1076
1077 #if defined(OS_ANDROID)
1078 // Flaky on android: https://crbug.com/639706
1079 #define MAYBE_ReceiveTraceFailsOnHigherHistogramSample \
1080 DISABLED_ReceiveTraceFailsOnHigherHistogramSample
1081 #else
1082 #define MAYBE_ReceiveTraceFailsOnHigherHistogramSample \
1083 ReceiveTraceFailsOnHigherHistogramSample
1084 #endif
1085
942 // This tests that histogram values > upper reference value don't trigger. 1086 // This tests that histogram values > upper reference value don't trigger.
943 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 1087 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
944 ReceiveTraceFailsOnHigherHistogramSample) { 1088 MAYBE_ReceiveTraceFailsOnHigherHistogramSample) {
945 { 1089 {
946 SetupBackgroundTracingManager(); 1090 SetupBackgroundTracingManager();
947 1091
948 base::RunLoop run_loop; 1092 base::RunLoop run_loop;
949 1093
950 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 1094 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
951 run_loop.QuitClosure()); 1095 run_loop.QuitClosure());
952 1096
953 base::DictionaryValue dict; 1097 base::DictionaryValue dict;
954 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); 1098 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE");
(...skipping 27 matching lines...) Expand all
982 // This should fail to trigger a trace since the sample value > the 1126 // This should fail to trigger a trace since the sample value > the
983 // the upper reference value above. 1127 // the upper reference value above.
984 LOCAL_HISTOGRAM_COUNTS("fake", 0); 1128 LOCAL_HISTOGRAM_COUNTS("fake", 0);
985 1129
986 run_loop.RunUntilIdle(); 1130 run_loop.RunUntilIdle();
987 1131
988 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0); 1132 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 0);
989 } 1133 }
990 } 1134 }
991 1135
1136 #if defined(OS_ANDROID)
1137 // Flaky on android: https://crbug.com/639706
1138 #define MAYBE_SetActiveScenarioFailsWithInvalidPreemptiveConfig \
1139 DISABLED_SetActiveScenarioFailsWithInvalidPreemptiveConfig
1140 #else
1141 #define MAYBE_SetActiveScenarioFailsWithInvalidPreemptiveConfig \
1142 SetActiveScenarioFailsWithInvalidPreemptiveConfig
1143 #endif
1144
992 // This tests that invalid preemptive mode configs will fail. 1145 // This tests that invalid preemptive mode configs will fail.
993 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 1146 IN_PROC_BROWSER_TEST_F(
994 SetActiveScenarioFailsWithInvalidPreemptiveConfig) { 1147 BackgroundTracingManagerBrowserTest,
1148 MAYBE_SetActiveScenarioFailsWithInvalidPreemptiveConfig) {
995 { 1149 {
996 SetupBackgroundTracingManager(); 1150 SetupBackgroundTracingManager();
997 1151
998 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 1152 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
999 (base::Closure())); 1153 (base::Closure()));
1000 1154
1001 base::DictionaryValue dict; 1155 base::DictionaryValue dict;
1002 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); 1156 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE");
1003 dict.SetString("category", "BENCHMARK"); 1157 dict.SetString("category", "BENCHMARK");
1004 1158
1005 std::unique_ptr<base::ListValue> rules_list(new base::ListValue()); 1159 std::unique_ptr<base::ListValue> rules_list(new base::ListValue());
1006 { 1160 {
1007 std::unique_ptr<base::DictionaryValue> rules_dict( 1161 std::unique_ptr<base::DictionaryValue> rules_dict(
1008 new base::DictionaryValue()); 1162 new base::DictionaryValue());
1009 rules_dict->SetString("rule", "INVALID_RULE"); 1163 rules_dict->SetString("rule", "INVALID_RULE");
1010 rules_list->Append(std::move(rules_dict)); 1164 rules_list->Append(std::move(rules_dict));
1011 } 1165 }
1012 1166
1013 dict.Set("configs", std::move(rules_list)); 1167 dict.Set("configs", std::move(rules_list));
1014 1168
1015 std::unique_ptr<BackgroundTracingConfig> config( 1169 std::unique_ptr<BackgroundTracingConfig> config(
1016 BackgroundTracingConfigImpl::FromDict(&dict)); 1170 BackgroundTracingConfigImpl::FromDict(&dict));
1017 // An invalid config should always return a nullptr here. 1171 // An invalid config should always return a nullptr here.
1018 EXPECT_FALSE(config); 1172 EXPECT_FALSE(config);
1019 } 1173 }
1020 } 1174 }
1021 1175
1176 #if defined(OS_ANDROID)
1177 // Flaky on android: https://crbug.com/639706
1178 #define MAYBE_ReactiveTimeoutTermination DISABLED_ReactiveTimeoutTermination
1179 #else
1180 #define MAYBE_ReactiveTimeoutTermination ReactiveTimeoutTermination
1181 #endif
1182
1022 // This tests that reactive mode records and terminates with timeout. 1183 // This tests that reactive mode records and terminates with timeout.
1023 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 1184 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
1024 ReactiveTimeoutTermination) { 1185 MAYBE_ReactiveTimeoutTermination) {
1025 { 1186 {
1026 SetupBackgroundTracingManager(); 1187 SetupBackgroundTracingManager();
1027 1188
1028 base::RunLoop run_loop; 1189 base::RunLoop run_loop;
1029 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 1190 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
1030 run_loop.QuitClosure()); 1191 run_loop.QuitClosure());
1031 1192
1032 std::unique_ptr<BackgroundTracingConfig> config = CreateReactiveConfig(); 1193 std::unique_ptr<BackgroundTracingConfig> config = CreateReactiveConfig();
1033 1194
1034 BackgroundTracingManager::TriggerHandle handle = 1195 BackgroundTracingManager::TriggerHandle handle =
(...skipping 11 matching lines...) Expand all
1046 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true)); 1207 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true));
1047 1208
1048 BackgroundTracingManager::GetInstance()->FireTimerForTesting(); 1209 BackgroundTracingManager::GetInstance()->FireTimerForTesting();
1049 1210
1050 run_loop.Run(); 1211 run_loop.Run();
1051 1212
1052 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 1213 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
1053 } 1214 }
1054 } 1215 }
1055 1216
1217 #if defined(OS_ANDROID)
1218 // Flaky on android: https://crbug.com/639706
1219 #define MAYBE_ReactiveSecondTriggerTermination \
1220 DISABLED_ReactiveSecondTriggerTermination
1221 #else
1222 #define MAYBE_ReactiveSecondTriggerTermination ReactiveSecondTriggerTermination
1223 #endif
1224
1056 // This tests that reactive mode records and terminates with a second trigger. 1225 // This tests that reactive mode records and terminates with a second trigger.
1057 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 1226 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
1058 ReactiveSecondTriggerTermination) { 1227 MAYBE_ReactiveSecondTriggerTermination) {
1059 { 1228 {
1060 SetupBackgroundTracingManager(); 1229 SetupBackgroundTracingManager();
1061 1230
1062 base::RunLoop run_loop; 1231 base::RunLoop run_loop;
1063 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 1232 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
1064 run_loop.QuitClosure()); 1233 run_loop.QuitClosure());
1065 1234
1066 std::unique_ptr<BackgroundTracingConfig> config = CreateReactiveConfig(); 1235 std::unique_ptr<BackgroundTracingConfig> config = CreateReactiveConfig();
1067 1236
1068 BackgroundTracingManager::TriggerHandle handle = 1237 BackgroundTracingManager::TriggerHandle handle =
(...skipping 12 matching lines...) Expand all
1081 // second trigger to terminate. 1250 // second trigger to terminate.
1082 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 1251 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
1083 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true)); 1252 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), true));
1084 1253
1085 run_loop.Run(); 1254 run_loop.Run();
1086 1255
1087 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 1256 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
1088 } 1257 }
1089 } 1258 }
1090 1259
1260 #if defined(OS_ANDROID)
1261 // Flaky on android: https://crbug.com/639706
1262 #define MAYBE_ReactiveSecondTriggerMustMatchForTermination \
1263 DISABLED_ReactiveSecondTriggerMustMatchForTermination
1264 #else
1265 #define MAYBE_ReactiveSecondTriggerMustMatchForTermination \
1266 ReactiveSecondTriggerMustMatchForTermination
1267 #endif
1268
1091 // This tests that reactive mode only terminates with the same trigger. 1269 // This tests that reactive mode only terminates with the same trigger.
1092 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 1270 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
1093 ReactiveSecondTriggerMustMatchForTermination) { 1271 MAYBE_ReactiveSecondTriggerMustMatchForTermination) {
1094 { 1272 {
1095 SetupBackgroundTracingManager(); 1273 SetupBackgroundTracingManager();
1096 1274
1097 base::RunLoop run_loop; 1275 base::RunLoop run_loop;
1098 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 1276 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
1099 run_loop.QuitClosure()); 1277 run_loop.QuitClosure());
1100 1278
1101 base::DictionaryValue dict; 1279 base::DictionaryValue dict;
1102 dict.SetString("mode", "REACTIVE_TRACING_MODE"); 1280 dict.SetString("mode", "REACTIVE_TRACING_MODE");
1103 1281
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 // second trigger to terminate. 1328 // second trigger to terminate.
1151 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 1329 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
1152 handle1, base::Bind(&StartedFinalizingCallback, base::Closure(), true)); 1330 handle1, base::Bind(&StartedFinalizingCallback, base::Closure(), true));
1153 1331
1154 run_loop.Run(); 1332 run_loop.Run();
1155 1333
1156 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 1334 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
1157 } 1335 }
1158 } 1336 }
1159 1337
1338 #if defined(OS_ANDROID)
1339 // Flaky on android: https://crbug.com/639706
1340 #define MAYBE_ReactiveThirdTriggerTimeout DISABLED_ReactiveThirdTriggerTimeout
1341 #else
1342 #define MAYBE_ReactiveThirdTriggerTimeout ReactiveThirdTriggerTimeout
1343 #endif
1344
1160 // This tests a third trigger in reactive more does not start another trace. 1345 // This tests a third trigger in reactive more does not start another trace.
1161 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, 1346 IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
1162 ReactiveThirdTriggerTimeout) { 1347 MAYBE_ReactiveThirdTriggerTimeout) {
1163 { 1348 {
1164 SetupBackgroundTracingManager(); 1349 SetupBackgroundTracingManager();
1165 1350
1166 base::RunLoop run_loop; 1351 base::RunLoop run_loop;
1167 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper( 1352 BackgroundTracingManagerUploadConfigWrapper upload_config_wrapper(
1168 run_loop.QuitClosure()); 1353 run_loop.QuitClosure());
1169 1354
1170 std::unique_ptr<BackgroundTracingConfig> config = CreateReactiveConfig(); 1355 std::unique_ptr<BackgroundTracingConfig> config = CreateReactiveConfig();
1171 1356
1172 BackgroundTracingManager::TriggerHandle handle = 1357 BackgroundTracingManager::TriggerHandle handle =
(...skipping 16 matching lines...) Expand all
1189 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( 1374 BackgroundTracingManager::GetInstance()->TriggerNamedEvent(
1190 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), false)); 1375 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), false));
1191 1376
1192 run_loop.Run(); 1377 run_loop.Run();
1193 1378
1194 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); 1379 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1);
1195 } 1380 }
1196 } 1381 }
1197 1382
1198 } // namespace content 1383 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698