Index: base/profiler/stack_sampling_profiler_unittest.cc |
diff --git a/base/profiler/stack_sampling_profiler_unittest.cc b/base/profiler/stack_sampling_profiler_unittest.cc |
index e1f09e13f7abfcfa29f8101ae3ac093e73379a8a..179dafa89d5253b0b1e06447127867959a0bdce3 100644 |
--- a/base/profiler/stack_sampling_profiler_unittest.cc |
+++ b/base/profiler/stack_sampling_profiler_unittest.cc |
@@ -393,6 +393,8 @@ void CaptureProfiles(const SamplingParams& params, TimeDelta profiler_wait_time, |
WithTargetThread([¶ms, profiles, |
profiler_wait_time](PlatformThreadId target_thread_id) { |
+ WaitableEvent profiler_completed(WaitableEvent::ResetPolicy::MANUAL, |
+ WaitableEvent::InitialState::NOT_SIGNALED); |
WaitableEvent sampling_thread_completed( |
WaitableEvent::ResetPolicy::MANUAL, |
WaitableEvent::InitialState::NOT_SIGNALED); |
@@ -402,8 +404,9 @@ void CaptureProfiles(const SamplingParams& params, TimeDelta profiler_wait_time, |
StackSamplingProfiler profiler(target_thread_id, params, callback); |
profiler.Start(); |
sampling_thread_completed.TimedWait(profiler_wait_time); |
- profiler.Stop(); |
- sampling_thread_completed.Wait(); |
+ profiler.Stop(&profiler_completed); |
+ profiler_completed.Wait(); |
+ ASSERT_TRUE(sampling_thread_completed.IsSignaled()); |
}); |
} |
@@ -765,35 +768,6 @@ TEST(StackSamplingProfilerTest, MAYBE_Alloca) { |
<< FormatSampleForDiagnosticOutput(sample, profile.modules); |
} |
-// Checks that the fire-and-forget interface works. |
-#if defined(STACK_SAMPLING_PROFILER_SUPPORTED) |
-#define MAYBE_StartAndRunAsync StartAndRunAsync |
-#else |
-#define MAYBE_StartAndRunAsync DISABLED_StartAndRunAsync |
-#endif |
-TEST(StackSamplingProfilerTest, MAYBE_StartAndRunAsync) { |
- // StartAndRunAsync requires the caller to have a message loop. |
- MessageLoop message_loop; |
- |
- SamplingParams params; |
- params.samples_per_burst = 1; |
- |
- CallStackProfiles profiles; |
- WithTargetThread([¶ms, &profiles](PlatformThreadId target_thread_id) { |
- WaitableEvent sampling_thread_completed( |
- WaitableEvent::ResetPolicy::AUTOMATIC, |
- WaitableEvent::InitialState::NOT_SIGNALED); |
- const StackSamplingProfiler::CompletedCallback callback = |
- Bind(&SaveProfilesAndSignalEvent, Unretained(&profiles), |
- Unretained(&sampling_thread_completed)); |
- StackSamplingProfiler::StartAndRunAsync(target_thread_id, params, callback); |
- RunLoop().RunUntilIdle(); |
- sampling_thread_completed.Wait(); |
- }); |
- |
- ASSERT_EQ(1u, profiles.size()); |
-} |
- |
// Checks that the expected number of profiles and samples are present in the |
// call stack profiles produced. |
#if defined(STACK_SAMPLING_PROFILER_SUPPORTED) |
@@ -898,6 +872,7 @@ TEST(StackSamplingProfilerTest, MAYBE_DestroyProfilerWhileProfiling) { |
}); |
} |
+#if 0 // Not currently supported. |
// Checks that we can destroy the thread under test while profiling. |
#if defined(STACK_SAMPLING_PROFILER_SUPPORTED) |
#define MAYBE_DestroyThreadWhileProfiling DestroyThreadWhileProfiling |
@@ -951,7 +926,7 @@ TEST(StackSamplingProfilerTest, MAYBE_DestroyThreadWhileProfiling) { |
thread_sampled.Wait(); |
// Stop sampling and wait for it to finish. |
- profiler.Stop(); |
+ profiler.Stop(nullptr); |
sampling_thread_completed.Wait(); |
// There should be one profile in which the first sample has frames and |
@@ -960,6 +935,7 @@ TEST(StackSamplingProfilerTest, MAYBE_DestroyThreadWhileProfiling) { |
EXPECT_NE(0U, profiles[0].samples.front().frames.size()); |
EXPECT_EQ(0U, profiles[0].samples.back().frames.size()); |
} |
+#endif |
// Checks that the same profiler may be run multiple times. |
#if defined(STACK_SAMPLING_PROFILER_SUPPORTED) |