OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/debug/activity_tracker.h" | 5 #include "base/debug/activity_tracker.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 t2.WaitReady(); | 387 t2.WaitReady(); |
388 EXPECT_EQ(starting_active + 1, GetGlobalActiveTrackerCount()); | 388 EXPECT_EQ(starting_active + 1, GetGlobalActiveTrackerCount()); |
389 EXPECT_EQ(starting_inactive, GetGlobalInactiveTrackerCount()); | 389 EXPECT_EQ(starting_inactive, GetGlobalInactiveTrackerCount()); |
390 | 390 |
391 t2.Exit(); | 391 t2.Exit(); |
392 t2.Join(); | 392 t2.Join(); |
393 EXPECT_EQ(starting_active, GetGlobalActiveTrackerCount()); | 393 EXPECT_EQ(starting_active, GetGlobalActiveTrackerCount()); |
394 EXPECT_EQ(starting_inactive + 1, GetGlobalInactiveTrackerCount()); | 394 EXPECT_EQ(starting_inactive + 1, GetGlobalInactiveTrackerCount()); |
395 } | 395 } |
396 | 396 |
397 TEST_F(ActivityTrackerTest, ProcessDeathTest) { | 397 // This test fails roughly 10% of runs on Android tablets. |
| 398 // See http://crbug.com/723060 for details. |
| 399 #if defined(OS_ANDROID) |
| 400 #define MAYBE_ProcessDeathTest DISABLED_ProcessDeathTest |
| 401 #else |
| 402 #define MAYBE_ProcessDeathTest ProcessDeathTest |
| 403 #endif |
| 404 |
| 405 TEST_F(ActivityTrackerTest, MAYBE_ProcessDeathTest) { |
398 // This doesn't actually create and destroy a process. Instead, it uses for- | 406 // This doesn't actually create and destroy a process. Instead, it uses for- |
399 // testing interfaces to simulate data created by other processes. | 407 // testing interfaces to simulate data created by other processes. |
400 const ProcessId other_process_id = GetCurrentProcId() + 1; | 408 const ProcessId other_process_id = GetCurrentProcId() + 1; |
401 | 409 |
402 GlobalActivityTracker::CreateWithLocalMemory(kMemorySize, 0, "", 3, 0); | 410 GlobalActivityTracker::CreateWithLocalMemory(kMemorySize, 0, "", 3, 0); |
403 GlobalActivityTracker* global = GlobalActivityTracker::Get(); | 411 GlobalActivityTracker* global = GlobalActivityTracker::Get(); |
404 ThreadActivityTracker* thread = global->GetOrCreateTrackerForCurrentThread(); | 412 ThreadActivityTracker* thread = global->GetOrCreateTrackerForCurrentThread(); |
405 | 413 |
406 // Get callbacks for process exit. | 414 // Get callbacks for process exit. |
407 global->SetProcessExitCallback( | 415 global->SetProcessExitCallback( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 global->allocator()->ChangeType( | 499 global->allocator()->ChangeType( |
492 tracker_ref, GlobalActivityTracker::kTypeIdActivityTracker, | 500 tracker_ref, GlobalActivityTracker::kTypeIdActivityTracker, |
493 GlobalActivityTracker::kTypeIdActivityTrackerFree, false); | 501 GlobalActivityTracker::kTypeIdActivityTrackerFree, false); |
494 global->allocator()->ChangeType( | 502 global->allocator()->ChangeType( |
495 user_data_ref, GlobalActivityTracker::kTypeIdUserDataRecord, | 503 user_data_ref, GlobalActivityTracker::kTypeIdUserDataRecord, |
496 GlobalActivityTracker::kTypeIdUserDataRecordFree, false); | 504 GlobalActivityTracker::kTypeIdUserDataRecordFree, false); |
497 } | 505 } |
498 | 506 |
499 } // namespace debug | 507 } // namespace debug |
500 } // namespace base | 508 } // namespace base |
OLD | NEW |