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

Unified Diff: ppapi/tests/test_media_stream_audio_track.cc

Issue 430943004: Return from |Configure()| asynchronously, and allow |InitBuffers()| to return errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pepper-mediastream-duration
Patch Set: Rebase. Created 6 years, 4 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 | « ppapi/tests/test_media_stream_audio_track.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_media_stream_audio_track.cc
diff --git a/ppapi/tests/test_media_stream_audio_track.cc b/ppapi/tests/test_media_stream_audio_track.cc
index 05cb0bf3ad7e3c013c1af185ca2fd1c62e812d8e..020cf0819be9e3c4549c01f53278d133647497c3 100644
--- a/ppapi/tests/test_media_stream_audio_track.cc
+++ b/ppapi/tests/test_media_stream_audio_track.cc
@@ -76,6 +76,7 @@ void TestMediaStreamAudioTrack::RunTests(const std::string& filter) {
RUN_TEST(Create, filter);
RUN_TEST(GetBuffer, filter);
RUN_TEST(Configure, filter);
+ RUN_TEST(ConfigureClose, filter);
}
void TestMediaStreamAudioTrack::HandleMessage(const pp::Var& message) {
@@ -204,6 +205,17 @@ std::string TestMediaStreamAudioTrack::TestConfigure() {
ASSERT_FALSE(audio_track_.HasEnded());
ASSERT_FALSE(audio_track_.GetId().empty());
+ // Perform a |Configure()| with no attributes. This ends up making an IPC
+ // call, but the host implementation has a fast-path when there are no changes
+ // to the configuration. This test is intended to hit that fast-path and make
+ // sure it works correctly.
+ {
+ int32_t attrib_list[] = {
+ PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE,
+ };
+ ASSERT_SUBTEST_SUCCESS(CheckConfigure(attrib_list, PP_OK));
+ }
+
// Configure number of buffers.
struct {
int32_t buffers;
@@ -293,3 +305,33 @@ std::string TestMediaStreamAudioTrack::TestConfigure() {
audio_track_ = pp::MediaStreamAudioTrack();
PASS();
}
+
+std::string TestMediaStreamAudioTrack::TestConfigureClose() {
+ // Create a track.
+ instance_->EvalScript(kJSCode);
+ event_.Wait();
+ event_.Reset();
+
+ ASSERT_FALSE(audio_track_.is_null());
+ ASSERT_FALSE(audio_track_.HasEnded());
+ ASSERT_FALSE(audio_track_.GetId().empty());
+
+ // Configure the audio track and close it immediately. The Configure() call
+ // should complete.
+ int32_t attrib_list[] = {
+ PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS, 10,
+ PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE,
+ };
+ TestCompletionCallback cc_configure(instance_->pp_instance(), false);
+ int32_t result = audio_track_.Configure(attrib_list,
+ cc_configure.GetCallback());
+ ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
+ audio_track_.Close();
+ cc_configure.WaitForResult(result);
+ result = cc_configure.result();
+ // Unfortunately, we can't control whether the configure succeeds or is
+ // aborted.
+ ASSERT_TRUE(result == PP_OK || result == PP_ERROR_ABORTED);
+
+ PASS();
+}
« no previous file with comments | « ppapi/tests/test_media_stream_audio_track.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698