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

Unified Diff: content/renderer/media/media_stream_audio_unittest.cc

Issue 2803183002: Revert of Move getUserMedia finish to "when audio track configured". (Closed)
Patch Set: Created 3 years, 8 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
Index: content/renderer/media/media_stream_audio_unittest.cc
diff --git a/content/renderer/media/media_stream_audio_unittest.cc b/content/renderer/media/media_stream_audio_unittest.cc
index 225e87b2cb09531d653169236dc3350ea9740240..7026025e403cfd68ad788b2de485a4f1b1f3bb5e 100644
--- a/content/renderer/media/media_stream_audio_unittest.cc
+++ b/content/renderer/media/media_stream_audio_unittest.cc
@@ -6,7 +6,6 @@
#include "base/atomicops.h"
#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/test_timeouts.h"
@@ -17,7 +16,6 @@
#include "content/renderer/media/media_stream_audio_track.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_parameters.h"
-#include "media/base/bind_to_current_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/web/WebHeap.h"
@@ -241,9 +239,6 @@
} // namespace
class MediaStreamAudioTest : public ::testing::Test {
- public:
- void CallbackFunction() { callback_is_called_ = true; }
-
protected:
void SetUp() override {
blink_audio_source_.initialize(blink::WebString::fromUTF8("audio_id"),
@@ -273,8 +268,6 @@
blink::WebMediaStreamTrack blink_audio_track_;
base::MessageLoop message_loop_;
-
- bool callback_is_called_ = false;
};
// Tests that a simple source-->track-->sink connection and audio data flow
@@ -460,31 +453,4 @@
track()->RemoveSink(&sink);
}
-// Tests that a callback is fired when initialization completes on a track.
-TEST_F(MediaStreamAudioTest, CallbackOnTrackInitialization) {
- // Create a source, connect it to track, and connect the track to a
- // sink.
- blink_audio_source_.setExtraData(new FakeMediaStreamAudioSource());
- ASSERT_TRUE(source());
- EXPECT_TRUE(source()->ConnectToTrack(blink_audio_track_));
- ASSERT_TRUE(track());
- FakeMediaStreamAudioSink sink;
- ASSERT_TRUE(!sink.params().IsValid());
- track()->AddSink(&sink);
- // The test callback is not thread-safe, so needs to be called on the
- // current thread, not the thread from which it is triggered.
- track()->SetFormatConfiguredCallback(media::BindToCurrentLoop(base::Bind(
- &MediaStreamAudioTest::CallbackFunction, base::Unretained(this))));
- EXPECT_FALSE(callback_is_called_);
- // Wait until valid parameters are propagated to the sink, and then confirm
- // the parameters are correct at the track and the sink.
- while (!sink.params().IsValid())
- base::PlatformThread::Sleep(TestTimeouts::tiny_timeout());
- // Since the callback is waiting to run on this thread, we have to run
- // an event loop.
- base::RunLoop().RunUntilIdle();
- EXPECT_TRUE(callback_is_called_);
- track()->RemoveSink(&sink);
-}
-
} // namespace content
« no previous file with comments | « content/renderer/media/media_stream_audio_track.cc ('k') | content/renderer/media/user_media_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698