diff options
author | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 23:20:24 +0000 |
---|---|---|
committer | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 23:20:24 +0000 |
commit | 445623e613be115931b6b83dfa5f46d471fb0854 (patch) | |
tree | d79b08da87a87b915cb9638172b6357e729d7c19 /chrome/renderer | |
parent | 141c26dd8d4fea199546db1cb7b3c6644fff0e06 (diff) | |
download | chromium_src-445623e613be115931b6b83dfa5f46d471fb0854.zip chromium_src-445623e613be115931b6b83dfa5f46d471fb0854.tar.gz chromium_src-445623e613be115931b6b83dfa5f46d471fb0854.tar.bz2 |
Revert 42656 - Add a Pepper audio basic functionality unit test.
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/1207005
TBR=neb@chromium.org
Review URL: http://codereview.chromium.org/1344003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42692 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/mock_render_thread.cc | 12 | ||||
-rw-r--r-- | chrome/renderer/mock_render_thread.h | 4 | ||||
-rw-r--r-- | chrome/renderer/pepper_devices_unittest.cc | 27 |
3 files changed, 3 insertions, 40 deletions
diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc index 35383cb..1fa513f 100644 --- a/chrome/renderer/mock_render_thread.cc +++ b/chrome/renderer/mock_render_thread.cc @@ -34,16 +34,6 @@ void MockRenderThread::RemoveRoute(int32 routing_id) { widget_ = NULL; } -// Called by, for example, RenderView::Init(), when adding a new message filter -void MockRenderThread::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { - filter->OnFilterAdded(&sink()); -} - -// Called when the filter is removed -void MockRenderThread::RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) { - filter->OnFilterRemoved(); -} - // Called by the Widget. Used to send messages to the browser. // We short-circuit the mechanim and handle the messages right here on this // class. @@ -76,7 +66,7 @@ void MockRenderThread::SendCloseMessage() { void MockRenderThread::OnMessageReceived(const IPC::Message& msg) { // Save the message in the sink. - sink_.Send(const_cast<IPC::Message*>(&msg)); + sink_.OnMessageReceived(msg); // Some messages we do special handling. bool handled = true; diff --git a/chrome/renderer/mock_render_thread.h b/chrome/renderer/mock_render_thread.h index 24d646e..4f3b1d9 100644 --- a/chrome/renderer/mock_render_thread.h +++ b/chrome/renderer/mock_render_thread.h @@ -41,8 +41,8 @@ class MockRenderThread : public RenderThreadBase { virtual bool Send(IPC::Message* msg); // Our mock thread doesn't do filtering. - virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter); - virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); + virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) { } + virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) { } // Our mock thread doesn't deal with hidden and restored tabs. virtual void WidgetHidden() { } diff --git a/chrome/renderer/pepper_devices_unittest.cc b/chrome/renderer/pepper_devices_unittest.cc index d7d2a6e..b793a4e 100644 --- a/chrome/renderer/pepper_devices_unittest.cc +++ b/chrome/renderer/pepper_devices_unittest.cc @@ -117,9 +117,6 @@ 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; @@ -221,10 +218,6 @@ 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. @@ -257,23 +250,3 @@ 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(0, memcmp(&config, &context.config, sizeof(config))); - EXPECT_EQ(NPERR_NO_ERROR, - pepper_plugin()->DeviceAudioDestroyContext(&context)); - EXPECT_TRUE(render_thread_.sink().GetFirstMessageMatching( - ViewHostMsg_CloseAudioStream::ID)); -} - |