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

Unified Diff: third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp

Issue 2857333006: Fix flakiness in PushPullFIFOSmokeTest.SmokeTests/7 (Closed)
Patch Set: Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp
diff --git a/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp b/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp
index 6034d496a9031b61643d0a1fa0e0acdc539ba9c5..358452b79fa5bee2adb0b6b652dfa3c096a373d2 100644
--- a/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp
+++ b/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp
@@ -47,15 +47,21 @@ class FIFOClient {
: fifo_(fifo),
bus_(AudioBus::Create(fifo->NumberOfChannels(), bus_length)),
client_thread_(Platform::Current()->CreateThread("client thread")),
+ done_event_(WTF::MakeUnique<WaitableEvent>()),
jitter_range_ms_(jitter_range_ms) {}
- void Start(double duration_ms, double interval_ms) {
+ ~FIFOClient() {
+ client_thread_.reset();
o1ka 2017/05/08 12:11:56 Why is it needed?
hongchan 2017/05/08 18:19:33 Removed.
+ }
+
+ WaitableEvent* Start(double duration_ms, double interval_ms) {
duration_ms_ = duration_ms;
interval_ms_ = interval_ms;
client_thread_->GetWebTaskRunner()->PostTask(
BLINK_FROM_HERE,
CrossThreadBind(&FIFOClient::RunTaskOnOwnThread,
CrossThreadUnretained(this)));
+ return done_event_.get();
}
virtual void Stop(int callback_counter) = 0;
@@ -84,12 +90,14 @@ class FIFOClient {
interval_with_jitter);
} else {
Stop(counter_);
+ done_event_->Signal();
}
}
PushPullFIFO* fifo_;
RefPtr<AudioBus> bus_;
std::unique_ptr<WebThread> client_thread_;
+ std::unique_ptr<WaitableEvent> done_event_;
// Test duration.
double duration_ms_;
@@ -179,14 +187,22 @@ TEST_P(PushPullFIFOSmokeTest, SmokeTests) {
std::unique_ptr<PushClient> push_client = WTF::WrapUnique(new PushClient(
test_fifo.get(), param.push_buffer_size, param.push_jitter_range_ms));
- LOG(INFO) << "PushPullFIFOSmokeTest - Start";
+ Vector<WaitableEvent*> done_events;
+ done_events.push_back(
+ pull_client->Start(param.test_duration_ms, pull_interval_ms));
+ done_events.push_back(
+ push_client->Start(param.test_duration_ms, push_interval_ms));
+
+ LOG(INFO) << "PushPullFIFOSmokeTest - Started";
- pull_client->Start(param.test_duration_ms, pull_interval_ms);
- push_client->Start(param.test_duration_ms, push_interval_ms);
+ // We have to wait both of events to be signaled.
+ WaitableEvent::WaitMultiple(done_events);
+ WaitableEvent::WaitMultiple(done_events);
// If the operation does not cause a crash for the test period, it's passed.
- // Also give a bit more time to finish the tear-down process.
- HoldTestForDuration(param.test_duration_ms + 150);
+ // Also give a bit more time (10ms per iteration) to finish the tear-down
o1ka 2017/05/08 12:11:56 Not sure what tear down process do you mean? Nothi
hongchan 2017/05/08 18:19:33 Done.
+ // process.
+ HoldTestForDuration(10);
}
FIFOSmokeTestParam smoke_test_params[] = {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698