diff options
author | neb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 17:35:01 +0000 |
---|---|---|
committer | neb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 17:35:01 +0000 |
commit | 90b721e6713f6429a24fe03d4f0dbab588f7dc46 (patch) | |
tree | 51d7864d9870feccdf0be9cf1fe63129fa7e66c3 /chrome/renderer/pepper_devices_unittest.cc | |
parent | c847d9f297af987bf24a5ccf17c3a29675f582aa (diff) | |
download | chromium_src-90b721e6713f6429a24fe03d4f0dbab588f7dc46.zip chromium_src-90b721e6713f6429a24fe03d4f0dbab588f7dc46.tar.gz chromium_src-90b721e6713f6429a24fe03d4f0dbab588f7dc46.tar.bz2 |
Pepper audio basic functionality unit test, take 3.
Also changed TestSink to be derived from IPC::Channel and made MockRenderThread service AddFilter/RemoveFilter, so that it can be used by MessageFilters.
Review URL: http://codereview.chromium.org/1591009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43623 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/pepper_devices_unittest.cc')
-rw-r--r-- | chrome/renderer/pepper_devices_unittest.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/renderer/pepper_devices_unittest.cc b/chrome/renderer/pepper_devices_unittest.cc index de4941e..02a93cb 100644 --- a/chrome/renderer/pepper_devices_unittest.cc +++ b/chrome/renderer/pepper_devices_unittest.cc @@ -117,6 +117,9 @@ class PepperDeviceTest : public RenderViewTest { NPError err, NPUserData* user_data); + // Audio callback, currently empty. + static void AudioCallback(NPDeviceContextAudio* context); + // A log of flush commands we can use to check the async callbacks. struct FlushData { NPP instance; @@ -218,6 +221,10 @@ void PepperDeviceTest::FlushCalled(NPP instance, that->flush_calls_.push_back(flush_data); } +void PepperDeviceTest::AudioCallback(NPDeviceContextAudio* context) { +} + + // ----------------------------------------------------------------------------- // TODO(brettw) this crashes on Mac. Figure out why and enable. @@ -250,3 +257,22 @@ TEST_F(PepperDeviceTest, Flush) { EXPECT_EQ(1u, flush_calls_.size()); } #endif + +TEST_F(PepperDeviceTest, AudioInit) { + NPDeviceContextAudioConfig config; + config.sampleRate = NPAudioSampleRate44100Hz; + config.sampleType = NPAudioSampleTypeInt16; + config.outputChannelMap = NPAudioChannelStereo; + config.callback = &AudioCallback; + config.userData = this; + NPDeviceContextAudio context; + EXPECT_EQ(NPERR_NO_ERROR, + pepper_plugin()->DeviceAudioInitializeContext(&config, &context)); + EXPECT_TRUE(render_thread_.sink().GetFirstMessageMatching( + ViewHostMsg_CreateAudioStream::ID)); + EXPECT_EQ(NPERR_NO_ERROR, + pepper_plugin()->DeviceAudioDestroyContext(&context)); + EXPECT_TRUE(render_thread_.sink().GetFirstMessageMatching( + ViewHostMsg_CloseAudioStream::ID)); +} + |