| 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 "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 void DumpCallbackAdapter(scoped_refptr<SingleThreadTaskRunner> task_runner, | 64 void DumpCallbackAdapter(scoped_refptr<SingleThreadTaskRunner> task_runner, |
| 65 Closure closure, | 65 Closure closure, |
| 66 uint64 dump_guid, | 66 uint64 dump_guid, |
| 67 bool success) { | 67 bool success) { |
| 68 last_callback_success_ = success; | 68 last_callback_success_ = success; |
| 69 task_runner->PostTask(FROM_HERE, closure); | 69 task_runner->PostTask(FROM_HERE, closure); |
| 70 } | 70 } |
| 71 | 71 |
| 72 protected: | 72 protected: |
| 73 const char* kTraceCategory = MemoryDumpManager::kTraceCategoryForTesting; | |
| 74 | |
| 75 void EnableTracing(const char* category) { | 73 void EnableTracing(const char* category) { |
| 76 TraceLog::GetInstance()->SetEnabled( | 74 TraceLog::GetInstance()->SetEnabled( |
| 77 TraceConfig(category, ""), TraceLog::RECORDING_MODE); | 75 TraceConfig(category, ""), TraceLog::RECORDING_MODE); |
| 78 } | 76 } |
| 79 | 77 |
| 80 void DisableTracing() { TraceLog::GetInstance()->SetDisabled(); } | 78 void DisableTracing() { TraceLog::GetInstance()->SetDisabled(); } |
| 81 | 79 |
| 82 scoped_ptr<MemoryDumpManager> mdm_; | 80 scoped_ptr<MemoryDumpManager> mdm_; |
| 83 bool last_callback_success_; | 81 bool last_callback_success_; |
| 84 | 82 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 166 |
| 169 // Check that the dumper is not called if the memory category is not enabled. | 167 // Check that the dumper is not called if the memory category is not enabled. |
| 170 EnableTracing("foo-and-bar-but-not-memory"); | 168 EnableTracing("foo-and-bar-but-not-memory"); |
| 171 EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(0); | 169 EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(0); |
| 172 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 170 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 173 high_detail_args); | 171 high_detail_args); |
| 174 DisableTracing(); | 172 DisableTracing(); |
| 175 | 173 |
| 176 // Now repeat enabling the memory category and check that the dumper is | 174 // Now repeat enabling the memory category and check that the dumper is |
| 177 // invoked this time. | 175 // invoked this time. |
| 178 EnableTracing(kTraceCategory); | 176 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 179 EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(3).WillRepeatedly(Return(true)); | 177 EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(3).WillRepeatedly(Return(true)); |
| 180 for (int i = 0; i < 3; ++i) | 178 for (int i = 0; i < 3; ++i) |
| 181 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 179 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 182 high_detail_args); | 180 high_detail_args); |
| 183 DisableTracing(); | 181 DisableTracing(); |
| 184 | 182 |
| 185 mdm_->UnregisterDumpProvider(&mdp); | 183 mdm_->UnregisterDumpProvider(&mdp); |
| 186 | 184 |
| 187 // Finally check the unregister logic (no calls to the mdp after unregister). | 185 // Finally check the unregister logic (no calls to the mdp after unregister). |
| 188 EnableTracing(kTraceCategory); | 186 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 189 EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(0); | 187 EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(0); |
| 190 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 188 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 191 high_detail_args); | 189 high_detail_args); |
| 192 TraceLog::GetInstance()->SetDisabled(); | 190 TraceLog::GetInstance()->SetDisabled(); |
| 193 } | 191 } |
| 194 | 192 |
| 195 TEST_F(MemoryDumpManagerTest, CheckMemoryDumpArgs) { | 193 TEST_F(MemoryDumpManagerTest, CheckMemoryDumpArgs) { |
| 196 // Check that requesting dumps with high level of detail actually propagates | 194 // Check that requesting dumps with high level of detail actually propagates |
| 197 // to OnMemoryDump() call on dump providers. | 195 // to OnMemoryDump() call on dump providers. |
| 198 MockDumpProvider mdp_high_detail(MemoryDumpArgs::LevelOfDetail::HIGH); | 196 MockDumpProvider mdp_high_detail(MemoryDumpArgs::LevelOfDetail::HIGH); |
| 199 mdm_->RegisterDumpProvider(&mdp_high_detail); | 197 mdm_->RegisterDumpProvider(&mdp_high_detail); |
| 200 | 198 |
| 201 EnableTracing(kTraceCategory); | 199 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 202 EXPECT_CALL(mdp_high_detail, OnMemoryDump(_, _)) | 200 EXPECT_CALL(mdp_high_detail, OnMemoryDump(_, _)) |
| 203 .Times(1) | 201 .Times(1) |
| 204 .WillRepeatedly( | 202 .WillRepeatedly( |
| 205 Invoke(&mdp_high_detail, | 203 Invoke(&mdp_high_detail, |
| 206 &MockDumpProvider::OnMemoryDump_CheckMemoryDumpArgs)); | 204 &MockDumpProvider::OnMemoryDump_CheckMemoryDumpArgs)); |
| 207 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 205 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 208 high_detail_args); | 206 high_detail_args); |
| 209 DisableTracing(); | 207 DisableTracing(); |
| 210 mdm_->UnregisterDumpProvider(&mdp_high_detail); | 208 mdm_->UnregisterDumpProvider(&mdp_high_detail); |
| 211 | 209 |
| 212 // Check that requesting dumps with low level of detail actually propagates to | 210 // Check that requesting dumps with low level of detail actually propagates to |
| 213 // OnMemoryDump() call on dump providers. | 211 // OnMemoryDump() call on dump providers. |
| 214 MockDumpProvider mdp_low_detail(MemoryDumpArgs::LevelOfDetail::LOW); | 212 MockDumpProvider mdp_low_detail(MemoryDumpArgs::LevelOfDetail::LOW); |
| 215 mdm_->RegisterDumpProvider(&mdp_low_detail); | 213 mdm_->RegisterDumpProvider(&mdp_low_detail); |
| 216 | 214 |
| 217 EnableTracing(kTraceCategory); | 215 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 218 EXPECT_CALL(mdp_low_detail, OnMemoryDump(_, _)) | 216 EXPECT_CALL(mdp_low_detail, OnMemoryDump(_, _)) |
| 219 .Times(1) | 217 .Times(1) |
| 220 .WillRepeatedly( | 218 .WillRepeatedly( |
| 221 Invoke(&mdp_low_detail, | 219 Invoke(&mdp_low_detail, |
| 222 &MockDumpProvider::OnMemoryDump_CheckMemoryDumpArgs)); | 220 &MockDumpProvider::OnMemoryDump_CheckMemoryDumpArgs)); |
| 223 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 221 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 224 low_detail_args); | 222 low_detail_args); |
| 225 DisableTracing(); | 223 DisableTracing(); |
| 226 mdm_->UnregisterDumpProvider(&mdp_low_detail); | 224 mdm_->UnregisterDumpProvider(&mdp_low_detail); |
| 227 } | 225 } |
| 228 | 226 |
| 229 TEST_F(MemoryDumpManagerTest, SharedSessionState) { | 227 TEST_F(MemoryDumpManagerTest, SharedSessionState) { |
| 230 MockDumpProvider mdp1; | 228 MockDumpProvider mdp1; |
| 231 MockDumpProvider mdp2; | 229 MockDumpProvider mdp2; |
| 232 mdm_->RegisterDumpProvider(&mdp1); | 230 mdm_->RegisterDumpProvider(&mdp1); |
| 233 mdm_->RegisterDumpProvider(&mdp2); | 231 mdm_->RegisterDumpProvider(&mdp2); |
| 234 | 232 |
| 235 EnableTracing(kTraceCategory); | 233 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 236 EXPECT_CALL(mdp1, OnMemoryDump(_, _)) | 234 EXPECT_CALL(mdp1, OnMemoryDump(_, _)) |
| 237 .Times(2) | 235 .Times(2) |
| 238 .WillRepeatedly( | 236 .WillRepeatedly( |
| 239 Invoke(&mdp1, &MockDumpProvider::OnMemoryDump_CheckSessionState)); | 237 Invoke(&mdp1, &MockDumpProvider::OnMemoryDump_CheckSessionState)); |
| 240 EXPECT_CALL(mdp2, OnMemoryDump(_, _)) | 238 EXPECT_CALL(mdp2, OnMemoryDump(_, _)) |
| 241 .Times(2) | 239 .Times(2) |
| 242 .WillRepeatedly( | 240 .WillRepeatedly( |
| 243 Invoke(&mdp2, &MockDumpProvider::OnMemoryDump_CheckSessionState)); | 241 Invoke(&mdp2, &MockDumpProvider::OnMemoryDump_CheckSessionState)); |
| 244 | 242 |
| 245 for (int i = 0; i < 2; ++i) | 243 for (int i = 0; i < 2; ++i) |
| 246 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 244 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 247 high_detail_args); | 245 high_detail_args); |
| 248 | 246 |
| 249 DisableTracing(); | 247 DisableTracing(); |
| 250 } | 248 } |
| 251 | 249 |
| 252 TEST_F(MemoryDumpManagerTest, MultipleDumpers) { | 250 TEST_F(MemoryDumpManagerTest, MultipleDumpers) { |
| 253 MockDumpProvider mdp1; | 251 MockDumpProvider mdp1; |
| 254 MockDumpProvider mdp2; | 252 MockDumpProvider mdp2; |
| 255 | 253 |
| 256 // Enable only mdp1. | 254 // Enable only mdp1. |
| 257 mdm_->RegisterDumpProvider(&mdp1); | 255 mdm_->RegisterDumpProvider(&mdp1); |
| 258 EnableTracing(kTraceCategory); | 256 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 259 EXPECT_CALL(mdp1, OnMemoryDump(_, _)).Times(1).WillRepeatedly(Return(true)); | 257 EXPECT_CALL(mdp1, OnMemoryDump(_, _)).Times(1).WillRepeatedly(Return(true)); |
| 260 EXPECT_CALL(mdp2, OnMemoryDump(_, _)).Times(0); | 258 EXPECT_CALL(mdp2, OnMemoryDump(_, _)).Times(0); |
| 261 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 259 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 262 high_detail_args); | 260 high_detail_args); |
| 263 DisableTracing(); | 261 DisableTracing(); |
| 264 | 262 |
| 265 // Invert: enable mdp1 and disable mdp2. | 263 // Invert: enable mdp1 and disable mdp2. |
| 266 mdm_->UnregisterDumpProvider(&mdp1); | 264 mdm_->UnregisterDumpProvider(&mdp1); |
| 267 mdm_->RegisterDumpProvider(&mdp2); | 265 mdm_->RegisterDumpProvider(&mdp2); |
| 268 EnableTracing(kTraceCategory); | 266 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 269 EXPECT_CALL(mdp1, OnMemoryDump(_, _)).Times(0); | 267 EXPECT_CALL(mdp1, OnMemoryDump(_, _)).Times(0); |
| 270 EXPECT_CALL(mdp2, OnMemoryDump(_, _)).Times(1).WillRepeatedly(Return(true)); | 268 EXPECT_CALL(mdp2, OnMemoryDump(_, _)).Times(1).WillRepeatedly(Return(true)); |
| 271 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 269 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 272 high_detail_args); | 270 high_detail_args); |
| 273 DisableTracing(); | 271 DisableTracing(); |
| 274 | 272 |
| 275 // Enable both mdp1 and mdp2. | 273 // Enable both mdp1 and mdp2. |
| 276 mdm_->RegisterDumpProvider(&mdp1); | 274 mdm_->RegisterDumpProvider(&mdp1); |
| 277 EnableTracing(kTraceCategory); | 275 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 278 EXPECT_CALL(mdp1, OnMemoryDump(_, _)).Times(1).WillRepeatedly(Return(true)); | 276 EXPECT_CALL(mdp1, OnMemoryDump(_, _)).Times(1).WillRepeatedly(Return(true)); |
| 279 EXPECT_CALL(mdp2, OnMemoryDump(_, _)).Times(1).WillRepeatedly(Return(true)); | 277 EXPECT_CALL(mdp2, OnMemoryDump(_, _)).Times(1).WillRepeatedly(Return(true)); |
| 280 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 278 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 281 high_detail_args); | 279 high_detail_args); |
| 282 DisableTracing(); | 280 DisableTracing(); |
| 283 } | 281 } |
| 284 | 282 |
| 285 // Checks that the MemoryDumpManager respects the thread affinity when a | 283 // Checks that the MemoryDumpManager respects the thread affinity when a |
| 286 // MemoryDumpProvider specifies a task_runner(). The test starts creating 8 | 284 // MemoryDumpProvider specifies a task_runner(). The test starts creating 8 |
| 287 // threads and registering a MemoryDumpProvider on each of them. At each | 285 // threads and registering a MemoryDumpProvider on each of them. At each |
| (...skipping 12 matching lines...) Expand all Loading... |
| 300 threads.back()->Start(); | 298 threads.back()->Start(); |
| 301 mdps.push_back(new MockDumpProvider(threads.back()->task_runner())); | 299 mdps.push_back(new MockDumpProvider(threads.back()->task_runner())); |
| 302 MockDumpProvider* mdp = mdps.back(); | 300 MockDumpProvider* mdp = mdps.back(); |
| 303 mdm_->RegisterDumpProvider(mdp, threads.back()->task_runner()); | 301 mdm_->RegisterDumpProvider(mdp, threads.back()->task_runner()); |
| 304 EXPECT_CALL(*mdp, OnMemoryDump(_, _)) | 302 EXPECT_CALL(*mdp, OnMemoryDump(_, _)) |
| 305 .Times(i) | 303 .Times(i) |
| 306 .WillRepeatedly( | 304 .WillRepeatedly( |
| 307 Invoke(mdp, &MockDumpProvider::OnMemoryDump_CheckTaskRunner)); | 305 Invoke(mdp, &MockDumpProvider::OnMemoryDump_CheckTaskRunner)); |
| 308 } | 306 } |
| 309 | 307 |
| 310 EnableTracing(kTraceCategory); | 308 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 311 | 309 |
| 312 while (!threads.empty()) { | 310 while (!threads.empty()) { |
| 313 last_callback_success_ = false; | 311 last_callback_success_ = false; |
| 314 { | 312 { |
| 315 RunLoop run_loop; | 313 RunLoop run_loop; |
| 316 MemoryDumpCallback callback = | 314 MemoryDumpCallback callback = |
| 317 Bind(&MemoryDumpManagerTest::DumpCallbackAdapter, Unretained(this), | 315 Bind(&MemoryDumpManagerTest::DumpCallbackAdapter, Unretained(this), |
| 318 MessageLoop::current()->task_runner(), run_loop.QuitClosure()); | 316 MessageLoop::current()->task_runner(), run_loop.QuitClosure()); |
| 319 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 317 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 320 high_detail_args, callback); | 318 high_detail_args, callback); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 345 } | 343 } |
| 346 | 344 |
| 347 // Enable both dump providers, make sure that mdp gets disabled after 3 failures | 345 // Enable both dump providers, make sure that mdp gets disabled after 3 failures |
| 348 // and not disabled after 1. | 346 // and not disabled after 1. |
| 349 TEST_F(MemoryDumpManagerTest, DisableFailingDumpers) { | 347 TEST_F(MemoryDumpManagerTest, DisableFailingDumpers) { |
| 350 MockDumpProvider mdp1; | 348 MockDumpProvider mdp1; |
| 351 MockDumpProvider mdp2; | 349 MockDumpProvider mdp2; |
| 352 | 350 |
| 353 mdm_->RegisterDumpProvider(&mdp1); | 351 mdm_->RegisterDumpProvider(&mdp1); |
| 354 mdm_->RegisterDumpProvider(&mdp2); | 352 mdm_->RegisterDumpProvider(&mdp2); |
| 355 EnableTracing(kTraceCategory); | 353 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 356 | 354 |
| 357 EXPECT_CALL(mdp1, OnMemoryDump(_, _)) | 355 EXPECT_CALL(mdp1, OnMemoryDump(_, _)) |
| 358 .Times(MemoryDumpManager::kMaxConsecutiveFailuresCount) | 356 .Times(MemoryDumpManager::kMaxConsecutiveFailuresCount) |
| 359 .WillRepeatedly(Return(false)); | 357 .WillRepeatedly(Return(false)); |
| 360 | 358 |
| 361 EXPECT_CALL(mdp2, OnMemoryDump(_, _)) | 359 EXPECT_CALL(mdp2, OnMemoryDump(_, _)) |
| 362 .Times(1 + MemoryDumpManager::kMaxConsecutiveFailuresCount) | 360 .Times(1 + MemoryDumpManager::kMaxConsecutiveFailuresCount) |
| 363 .WillOnce(Return(false)) | 361 .WillOnce(Return(false)) |
| 364 .WillRepeatedly(Return(true)); | 362 .WillRepeatedly(Return(true)); |
| 365 for (int i = 0; i < 1 + MemoryDumpManager::kMaxConsecutiveFailuresCount; | 363 for (int i = 0; i < 1 + MemoryDumpManager::kMaxConsecutiveFailuresCount; |
| 366 i++) { | 364 i++) { |
| 367 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 365 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 368 high_detail_args); | 366 high_detail_args); |
| 369 } | 367 } |
| 370 | 368 |
| 371 DisableTracing(); | 369 DisableTracing(); |
| 372 } | 370 } |
| 373 | 371 |
| 374 // Sneakily register an extra memory dump provider while an existing one is | 372 // Sneakily register an extra memory dump provider while an existing one is |
| 375 // dumping and expect it to take part in the already active tracing session. | 373 // dumping and expect it to take part in the already active tracing session. |
| 376 TEST_F(MemoryDumpManagerTest, RegisterDumperWhileDumping) { | 374 TEST_F(MemoryDumpManagerTest, RegisterDumperWhileDumping) { |
| 377 MockDumpProvider mdp1; | 375 MockDumpProvider mdp1; |
| 378 MockDumpProvider mdp2; | 376 MockDumpProvider mdp2; |
| 379 | 377 |
| 380 mdp1.dump_provider_to_register_or_unregister = &mdp2; | 378 mdp1.dump_provider_to_register_or_unregister = &mdp2; |
| 381 mdm_->RegisterDumpProvider(&mdp1); | 379 mdm_->RegisterDumpProvider(&mdp1); |
| 382 EnableTracing(kTraceCategory); | 380 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 383 | 381 |
| 384 EXPECT_CALL(mdp1, OnMemoryDump(_, _)) | 382 EXPECT_CALL(mdp1, OnMemoryDump(_, _)) |
| 385 .Times(4) | 383 .Times(4) |
| 386 .WillOnce(Return(true)) | 384 .WillOnce(Return(true)) |
| 387 .WillOnce(Invoke( | 385 .WillOnce(Invoke( |
| 388 &mdp1, &MockDumpProvider::OnMemoryDump_RegisterExtraDumpProvider)) | 386 &mdp1, &MockDumpProvider::OnMemoryDump_RegisterExtraDumpProvider)) |
| 389 .WillRepeatedly(Return(true)); | 387 .WillRepeatedly(Return(true)); |
| 390 | 388 |
| 391 // Depending on the insertion order (before or after mdp1), mdp2 might be | 389 // Depending on the insertion order (before or after mdp1), mdp2 might be |
| 392 // called also immediately after it gets registered. | 390 // called also immediately after it gets registered. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 403 } | 401 } |
| 404 | 402 |
| 405 // Like the above, but suddenly unregister the dump provider. | 403 // Like the above, but suddenly unregister the dump provider. |
| 406 TEST_F(MemoryDumpManagerTest, UnregisterDumperWhileDumping) { | 404 TEST_F(MemoryDumpManagerTest, UnregisterDumperWhileDumping) { |
| 407 MockDumpProvider mdp1; | 405 MockDumpProvider mdp1; |
| 408 MockDumpProvider mdp2; | 406 MockDumpProvider mdp2; |
| 409 | 407 |
| 410 mdm_->RegisterDumpProvider(&mdp1, ThreadTaskRunnerHandle::Get()); | 408 mdm_->RegisterDumpProvider(&mdp1, ThreadTaskRunnerHandle::Get()); |
| 411 mdm_->RegisterDumpProvider(&mdp2, ThreadTaskRunnerHandle::Get()); | 409 mdm_->RegisterDumpProvider(&mdp2, ThreadTaskRunnerHandle::Get()); |
| 412 mdp1.dump_provider_to_register_or_unregister = &mdp2; | 410 mdp1.dump_provider_to_register_or_unregister = &mdp2; |
| 413 EnableTracing(kTraceCategory); | 411 EnableTracing(MemoryDumpManager::kTraceCategory); |
| 414 | 412 |
| 415 EXPECT_CALL(mdp1, OnMemoryDump(_, _)) | 413 EXPECT_CALL(mdp1, OnMemoryDump(_, _)) |
| 416 .Times(4) | 414 .Times(4) |
| 417 .WillOnce(Return(true)) | 415 .WillOnce(Return(true)) |
| 418 .WillOnce( | 416 .WillOnce( |
| 419 Invoke(&mdp1, &MockDumpProvider::OnMemoryDump_UnregisterDumpProvider)) | 417 Invoke(&mdp1, &MockDumpProvider::OnMemoryDump_UnregisterDumpProvider)) |
| 420 .WillRepeatedly(Return(true)); | 418 .WillRepeatedly(Return(true)); |
| 421 | 419 |
| 422 // Depending on the insertion order (before or after mdp1), mdp2 might have | 420 // Depending on the insertion order (before or after mdp1), mdp2 might have |
| 423 // been already called when OnMemoryDump_UnregisterDumpProvider happens. | 421 // been already called when OnMemoryDump_UnregisterDumpProvider happens. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 449 MessageLoop::current()->task_runner(), run_loop.QuitClosure()); | 447 MessageLoop::current()->task_runner(), run_loop.QuitClosure()); |
| 450 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, | 448 mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 451 high_detail_args, callback); | 449 high_detail_args, callback); |
| 452 run_loop.Run(); | 450 run_loop.Run(); |
| 453 } | 451 } |
| 454 EXPECT_FALSE(last_callback_success_); | 452 EXPECT_FALSE(last_callback_success_); |
| 455 } | 453 } |
| 456 | 454 |
| 457 } // namespace trace_event | 455 } // namespace trace_event |
| 458 } // namespace base | 456 } // namespace base |
| OLD | NEW |