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

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

Issue 2592233002: [memory-infra] Make thread check at unregistration stricter for new dump providers (Closed)
Patch Set: Created 4 years 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
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 <vector> 10 #include <vector>
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 last_callback_success_ = false; 1259 last_callback_success_ = false;
1260 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED, 1260 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED,
1261 MemoryDumpLevelOfDetail::DETAILED); 1261 MemoryDumpLevelOfDetail::DETAILED);
1262 EXPECT_FALSE(last_callback_success_); 1262 EXPECT_FALSE(last_callback_success_);
1263 1263
1264 ASSERT_TRUE(IsPeriodicDumpingEnabled()); 1264 ASSERT_TRUE(IsPeriodicDumpingEnabled());
1265 run_loop.Run(); 1265 run_loop.Run();
1266 DisableTracing(); 1266 DisableTracing();
1267 } 1267 }
1268 1268
1269 TEST_F(MemoryDumpManagerTest, TestBlacklistedUnsafeUnregistration) {
1270 InitializeMemoryDumpManager(false /* is_coordinator */);
1271 MockMemoryDumpProvider mdp1;
1272 RegisterDumpProvider(&mdp1, nullptr, kDefaultOptions,
1273 "BlacklistTestDumpProvider");
1274 // Not calling UnregisterAndDeleteDumpProviderSoon() should not crash.
1275 mdm_->UnregisterDumpProvider(&mdp1);
1276
1277 Thread thread("test thread");
1278 thread.Start();
1279 RegisterDumpProvider(&mdp1, thread.task_runner(), kDefaultOptions,
1280 "BlacklistTestDumpProvider");
1281 // Unregistering on wrong thread should not crash.
1282 mdm_->UnregisterDumpProvider(&mdp1);
1283 thread.Stop();
1284 }
1285
1269 } // namespace trace_event 1286 } // namespace trace_event
1270 } // namespace base 1287 } // namespace base
OLDNEW
« base/trace_event/memory_dump_manager.cc ('K') | « base/trace_event/memory_dump_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698