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/trace_event/memory_dump_manager.h" | 5 #include "base/trace_event/memory_dump_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(1); | 432 EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(1); |
433 EXPECT_CALL(mdp1, OnMemoryDump(_, _)).WillOnce(Return(true)); | 433 EXPECT_CALL(mdp1, OnMemoryDump(_, _)).WillOnce(Return(true)); |
434 EXPECT_CALL(mdp2, OnMemoryDump(_, _)).WillOnce(Return(true)); | 434 EXPECT_CALL(mdp2, OnMemoryDump(_, _)).WillOnce(Return(true)); |
435 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED, | 435 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED, |
436 MemoryDumpLevelOfDetail::DETAILED); | 436 MemoryDumpLevelOfDetail::DETAILED); |
437 DisableTracing(); | 437 DisableTracing(); |
438 } | 438 } |
439 | 439 |
440 // Checks that the dump provider invocations depend only on the current | 440 // Checks that the dump provider invocations depend only on the current |
441 // registration state and not on previous registrations and dumps. | 441 // registration state and not on previous registrations and dumps. |
442 TEST_F(MemoryDumpManagerTest, RegistrationConsistency) { | 442 // flaky: crbug.com/706874 |
| 443 TEST_F(MemoryDumpManagerTest, DISABLED_RegistrationConsistency) { |
443 InitializeMemoryDumpManager(false /* is_coordinator */); | 444 InitializeMemoryDumpManager(false /* is_coordinator */); |
444 MockMemoryDumpProvider mdp; | 445 MockMemoryDumpProvider mdp; |
445 | 446 |
446 RegisterDumpProvider(&mdp, ThreadTaskRunnerHandle::Get()); | 447 RegisterDumpProvider(&mdp, ThreadTaskRunnerHandle::Get()); |
447 | 448 |
448 { | 449 { |
449 EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(1); | 450 EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(1); |
450 EXPECT_CALL(mdp, OnMemoryDump(_, _)).WillOnce(Return(true)); | 451 EXPECT_CALL(mdp, OnMemoryDump(_, _)).WillOnce(Return(true)); |
451 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory); | 452 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory); |
452 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED, | 453 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED, |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 | 1007 |
1007 EnableTracingWithTraceConfig( | 1008 EnableTracingWithTraceConfig( |
1008 TraceConfigMemoryTestUtil::GetTraceConfig_PeriodicTriggers( | 1009 TraceConfigMemoryTestUtil::GetTraceConfig_PeriodicTriggers( |
1009 kLightDumpPeriodMs, kHeavyDumpPeriodMs)); | 1010 kLightDumpPeriodMs, kHeavyDumpPeriodMs)); |
1010 run_loop.Run(); | 1011 run_loop.Run(); |
1011 DisableTracing(); | 1012 DisableTracing(); |
1012 } | 1013 } |
1013 | 1014 |
1014 // Tests against race conditions that might arise when disabling tracing in the | 1015 // Tests against race conditions that might arise when disabling tracing in the |
1015 // middle of a global memory dump. | 1016 // middle of a global memory dump. |
1016 TEST_F(MemoryDumpManagerTest, DisableTracingWhileDumping) { | 1017 // flaky: crbug.com/706874 |
| 1018 TEST_F(MemoryDumpManagerTest, DISABLED_DisableTracingWhileDumping) { |
1017 base::WaitableEvent tracing_disabled_event( | 1019 base::WaitableEvent tracing_disabled_event( |
1018 WaitableEvent::ResetPolicy::AUTOMATIC, | 1020 WaitableEvent::ResetPolicy::AUTOMATIC, |
1019 WaitableEvent::InitialState::NOT_SIGNALED); | 1021 WaitableEvent::InitialState::NOT_SIGNALED); |
1020 InitializeMemoryDumpManager(false /* is_coordinator */); | 1022 InitializeMemoryDumpManager(false /* is_coordinator */); |
1021 | 1023 |
1022 // Register a bound dump provider. | 1024 // Register a bound dump provider. |
1023 std::unique_ptr<Thread> mdp_thread(new Thread("test thread")); | 1025 std::unique_ptr<Thread> mdp_thread(new Thread("test thread")); |
1024 mdp_thread->Start(); | 1026 mdp_thread->Start(); |
1025 MockMemoryDumpProvider mdp_with_affinity; | 1027 MockMemoryDumpProvider mdp_with_affinity; |
1026 RegisterDumpProvider(&mdp_with_affinity, mdp_thread->task_runner(), | 1028 RegisterDumpProvider(&mdp_with_affinity, mdp_thread->task_runner(), |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 thread.Start(); | 1291 thread.Start(); |
1290 RegisterDumpProvider(&mdp1, thread.task_runner(), kDefaultOptions, | 1292 RegisterDumpProvider(&mdp1, thread.task_runner(), kDefaultOptions, |
1291 "BlacklistTestDumpProvider"); | 1293 "BlacklistTestDumpProvider"); |
1292 // Unregistering on wrong thread should not crash. | 1294 // Unregistering on wrong thread should not crash. |
1293 mdm_->UnregisterDumpProvider(&mdp1); | 1295 mdm_->UnregisterDumpProvider(&mdp1); |
1294 thread.Stop(); | 1296 thread.Stop(); |
1295 } | 1297 } |
1296 | 1298 |
1297 } // namespace trace_event | 1299 } // namespace trace_event |
1298 } // namespace base | 1300 } // namespace base |
OLD | NEW |