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

Side by Side Diff: base/trace_event/memory_dump_manager_unittest.cc

Issue 2787823004: memory-infra: Disable two MemoryDumpManager tests on iOS (Closed)
Patch Set: rebase Created 3 years, 8 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 "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 14 matching lines...) Expand all
25 #include "base/threading/sequenced_task_runner_handle.h" 25 #include "base/threading/sequenced_task_runner_handle.h"
26 #include "base/threading/sequenced_worker_pool.h" 26 #include "base/threading/sequenced_worker_pool.h"
27 #include "base/threading/thread.h" 27 #include "base/threading/thread.h"
28 #include "base/threading/thread_task_runner_handle.h" 28 #include "base/threading/thread_task_runner_handle.h"
29 #include "base/trace_event/memory_dump_provider.h" 29 #include "base/trace_event/memory_dump_provider.h"
30 #include "base/trace_event/memory_dump_scheduler.h" 30 #include "base/trace_event/memory_dump_scheduler.h"
31 #include "base/trace_event/memory_infra_background_whitelist.h" 31 #include "base/trace_event/memory_infra_background_whitelist.h"
32 #include "base/trace_event/process_memory_dump.h" 32 #include "base/trace_event/process_memory_dump.h"
33 #include "base/trace_event/trace_buffer.h" 33 #include "base/trace_event/trace_buffer.h"
34 #include "base/trace_event/trace_config_memory_test_util.h" 34 #include "base/trace_event/trace_config_memory_test_util.h"
35 #include "testing/gmock/include/gmock/gmock.h" 35 #include "testing/gmock/include/gmock/gmock.h"
Primiano Tucci (use gerrit) 2017/03/31 09:59:50 plz ad an explicit include to build/build_config.h
36 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
37 37
38 using testing::_; 38 using testing::_;
39 using testing::AnyNumber; 39 using testing::AnyNumber;
40 using testing::AtMost; 40 using testing::AtMost;
41 using testing::Between; 41 using testing::Between;
42 using testing::Invoke; 42 using testing::Invoke;
43 using testing::Return; 43 using testing::Return;
44 44
45 namespace base { 45 namespace base {
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // flaky: crbug.com/706874 442 // Flaky on iOS, see crbug.com/706874
443 TEST_F(MemoryDumpManagerTest, DISABLED_RegistrationConsistency) { 443 #if defined(OS_IOS)
444 #define MAYBE_RegistrationConsistency DISABLED_RegistrationConsistency
445 #else
446 #define MAYBE_RegistrationConsistency RegistrationConsistency
447 #endif
448 TEST_F(MemoryDumpManagerTest, MAYBE_RegistrationConsistency) {
444 InitializeMemoryDumpManager(false /* is_coordinator */); 449 InitializeMemoryDumpManager(false /* is_coordinator */);
445 MockMemoryDumpProvider mdp; 450 MockMemoryDumpProvider mdp;
446 451
447 RegisterDumpProvider(&mdp, ThreadTaskRunnerHandle::Get()); 452 RegisterDumpProvider(&mdp, ThreadTaskRunnerHandle::Get());
448 453
449 { 454 {
450 EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(1); 455 EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(1);
451 EXPECT_CALL(mdp, OnMemoryDump(_, _)).WillOnce(Return(true)); 456 EXPECT_CALL(mdp, OnMemoryDump(_, _)).WillOnce(Return(true));
452 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory); 457 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory);
453 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED, 458 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED,
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 1012
1008 EnableTracingWithTraceConfig( 1013 EnableTracingWithTraceConfig(
1009 TraceConfigMemoryTestUtil::GetTraceConfig_PeriodicTriggers( 1014 TraceConfigMemoryTestUtil::GetTraceConfig_PeriodicTriggers(
1010 kLightDumpPeriodMs, kHeavyDumpPeriodMs)); 1015 kLightDumpPeriodMs, kHeavyDumpPeriodMs));
1011 run_loop.Run(); 1016 run_loop.Run();
1012 DisableTracing(); 1017 DisableTracing();
1013 } 1018 }
1014 1019
1015 // Tests against race conditions that might arise when disabling tracing in the 1020 // Tests against race conditions that might arise when disabling tracing in the
1016 // middle of a global memory dump. 1021 // middle of a global memory dump.
1017 // flaky: crbug.com/706874 1022 // Flaky on iOS, see crbug.com/706961
1018 TEST_F(MemoryDumpManagerTest, DISABLED_DisableTracingWhileDumping) { 1023 #if defined(OS_IOS)
1024 #define MAYBE_DisableTracingWhileDumping DISABLED_DisableTracingWhileDumping
1025 #else
1026 #define MAYBE_DisableTracingWhileDumping DisableTracingWhileDumping
1027 #endif
1028 TEST_F(MemoryDumpManagerTest, MAYBE_DisableTracingWhileDumping) {
1019 base::WaitableEvent tracing_disabled_event( 1029 base::WaitableEvent tracing_disabled_event(
1020 WaitableEvent::ResetPolicy::AUTOMATIC, 1030 WaitableEvent::ResetPolicy::AUTOMATIC,
1021 WaitableEvent::InitialState::NOT_SIGNALED); 1031 WaitableEvent::InitialState::NOT_SIGNALED);
1022 InitializeMemoryDumpManager(false /* is_coordinator */); 1032 InitializeMemoryDumpManager(false /* is_coordinator */);
1023 1033
1024 // Register a bound dump provider. 1034 // Register a bound dump provider.
1025 std::unique_ptr<Thread> mdp_thread(new Thread("test thread")); 1035 std::unique_ptr<Thread> mdp_thread(new Thread("test thread"));
1026 mdp_thread->Start(); 1036 mdp_thread->Start();
1027 MockMemoryDumpProvider mdp_with_affinity; 1037 MockMemoryDumpProvider mdp_with_affinity;
1028 RegisterDumpProvider(&mdp_with_affinity, mdp_thread->task_runner(), 1038 RegisterDumpProvider(&mdp_with_affinity, mdp_thread->task_runner(),
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 thread.Start(); 1301 thread.Start();
1292 RegisterDumpProvider(&mdp1, thread.task_runner(), kDefaultOptions, 1302 RegisterDumpProvider(&mdp1, thread.task_runner(), kDefaultOptions,
1293 "BlacklistTestDumpProvider"); 1303 "BlacklistTestDumpProvider");
1294 // Unregistering on wrong thread should not crash. 1304 // Unregistering on wrong thread should not crash.
1295 mdm_->UnregisterDumpProvider(&mdp1); 1305 mdm_->UnregisterDumpProvider(&mdp1);
1296 thread.Stop(); 1306 thread.Stop();
1297 } 1307 }
1298 1308
1299 } // namespace trace_event 1309 } // namespace trace_event
1300 } // namespace base 1310 } // namespace base
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