Index: base/debug/activity_tracker_unittest.cc |
diff --git a/base/debug/activity_tracker_unittest.cc b/base/debug/activity_tracker_unittest.cc |
index 0d98c0536ad3c34af3af6c39fcf9cb3538929ab4..64b3eeb71f395ea5a47b285ba1c76b386885c004 100644 |
--- a/base/debug/activity_tracker_unittest.cc |
+++ b/base/debug/activity_tracker_unittest.cc |
@@ -90,22 +90,22 @@ class ActivityTrackerTest : public testing::Test { |
GlobalActivityTracker::ProcessPhase phase, |
std::string&& command, |
ActivityUserData::Snapshot&& data) { |
- exit_id = id; |
- exit_stamp = stamp; |
- exit_code = code; |
- exit_phase = phase; |
- exit_command = std::move(command); |
- exit_data = std::move(data); |
+ exit_id_ = id; |
+ exit_stamp_ = stamp; |
+ exit_code_ = code; |
+ exit_phase_ = phase; |
+ exit_command_ = std::move(command); |
+ exit_data_ = std::move(data); |
} |
static void DoNothing() {} |
- int64_t exit_id = 0; |
- int64_t exit_stamp; |
- int exit_code; |
- GlobalActivityTracker::ProcessPhase exit_phase; |
- std::string exit_command; |
- ActivityUserData::Snapshot exit_data; |
+ int64_t exit_id_ = 0; |
+ int64_t exit_stamp_; |
+ int exit_code_; |
+ GlobalActivityTracker::ProcessPhase exit_phase_; |
+ std::string exit_command_; |
+ ActivityUserData::Snapshot exit_data_; |
}; |
TEST_F(ActivityTrackerTest, UserDataTest) { |
@@ -394,15 +394,7 @@ TEST_F(ActivityTrackerTest, ThreadDeathTest) { |
EXPECT_EQ(starting_inactive + 1, GetGlobalInactiveTrackerCount()); |
} |
-// This test fails roughly 10% of runs on Android tablets. |
-// See http://crbug.com/723060 for details. |
-#if defined(OS_ANDROID) |
-#define MAYBE_ProcessDeathTest DISABLED_ProcessDeathTest |
-#else |
-#define MAYBE_ProcessDeathTest ProcessDeathTest |
-#endif |
- |
-TEST_F(ActivityTrackerTest, MAYBE_ProcessDeathTest) { |
+TEST_F(ActivityTrackerTest, ProcessDeathTest) { |
// This doesn't actually create and destroy a process. Instead, it uses for- |
// testing interfaces to simulate data created by other processes. |
const ProcessId other_process_id = GetCurrentProcId() + 1; |
@@ -471,8 +463,12 @@ TEST_F(ActivityTrackerTest, MAYBE_ProcessDeathTest) { |
&owning_id, &stamp)); |
EXPECT_EQ(other_process_id, owning_id); |
+ // Wait for the current time to advance beyond the creation stamp. |
+ while (Time::Now().ToInternalValue() <= stamp) |
manzagop (departed)
2017/05/19 17:35:21
Could you instead use a timestamp in the past when
bcwhite
2017/05/19 18:04:07
Done.
|
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); |
+ |
// Check that process exit will perform callback and free the allocations. |
- ASSERT_EQ(0, exit_id); |
+ ASSERT_EQ(0, exit_id_); |
ASSERT_EQ(GlobalActivityTracker::kTypeIdProcessDataRecord, |
global->allocator()->GetType(proc_data_ref)); |
ASSERT_EQ(GlobalActivityTracker::kTypeIdActivityTracker, |
@@ -480,8 +476,8 @@ TEST_F(ActivityTrackerTest, MAYBE_ProcessDeathTest) { |
ASSERT_EQ(GlobalActivityTracker::kTypeIdUserDataRecord, |
global->allocator()->GetType(user_data_ref)); |
global->RecordProcessExit(other_process_id, 0); |
- EXPECT_EQ(other_process_id, exit_id); |
- EXPECT_EQ("foo --bar", exit_command); |
+ EXPECT_EQ(other_process_id, exit_id_); |
+ EXPECT_EQ("foo --bar", exit_command_); |
EXPECT_EQ(GlobalActivityTracker::kTypeIdProcessDataRecordFree, |
global->allocator()->GetType(proc_data_ref)); |
EXPECT_EQ(GlobalActivityTracker::kTypeIdActivityTrackerFree, |