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

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

Issue 11166002: Plumb render view ID from audio-related code in renderer through IPCs to AudioRendererHost in brows… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed tommi's comments and rebased. Created 8 years, 2 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/audio_message_filter_unittest.cc
diff --git a/content/renderer/media/audio_message_filter_unittest.cc b/content/renderer/media/audio_message_filter_unittest.cc
index 63f244f918121286f4cf625992d1a7fe5939af97..6e050537f4e3985598f40807241281140670bd63 100644
--- a/content/renderer/media/audio_message_filter_unittest.cc
+++ b/content/renderer/media/audio_message_filter_unittest.cc
@@ -2,14 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "content/common/media/audio_messages.h"
#include "content/renderer/media/audio_message_filter.h"
#include "media/audio/audio_output_ipc.h"
#include "testing/gtest/include/gtest/gtest.h"
+using media::AudioOutputIPC;
+
namespace {
+const int kRenderViewId = -2;
+
class MockAudioDelegate : public media::AudioOutputIPCDelegate {
public:
MockAudioDelegate() {
@@ -71,9 +76,10 @@ TEST(AudioMessageFilterTest, Basic) {
MessageLoop message_loop(MessageLoop::TYPE_IO);
scoped_refptr<AudioMessageFilter> filter(new AudioMessageFilter());
+ scoped_ptr<AudioOutputIPC> ipc(filter->CreateAudioOutputIPC(kRenderViewId));
MockAudioDelegate delegate;
- int stream_id = filter->AddDelegate(&delegate);
+ int stream_id = ipc->AddDelegate(&delegate);
// AudioMsg_NotifyStreamCreated
#if defined(OS_WIN)
@@ -102,19 +108,20 @@ TEST(AudioMessageFilterTest, Basic) {
delegate.Reset();
message_loop.RunAllPending();
- filter->RemoveDelegate(stream_id);
+ ipc->RemoveDelegate(stream_id);
}
TEST(AudioMessageFilterTest, Delegates) {
MessageLoop message_loop(MessageLoop::TYPE_IO);
scoped_refptr<AudioMessageFilter> filter(new AudioMessageFilter());
+ scoped_ptr<AudioOutputIPC> ipc(filter->CreateAudioOutputIPC(kRenderViewId));
MockAudioDelegate delegate1;
MockAudioDelegate delegate2;
- int stream_id1 = filter->AddDelegate(&delegate1);
- int stream_id2 = filter->AddDelegate(&delegate2);
+ int stream_id1 = ipc->AddDelegate(&delegate1);
+ int stream_id2 = ipc->AddDelegate(&delegate2);
// Send an IPC message. Make sure the correct delegate gets called.
EXPECT_FALSE(delegate1.state_changed_received());
@@ -137,6 +144,6 @@ TEST(AudioMessageFilterTest, Delegates) {
message_loop.RunAllPending();
- filter->RemoveDelegate(stream_id1);
- filter->RemoveDelegate(stream_id2);
+ ipc->RemoveDelegate(stream_id1);
+ ipc->RemoveDelegate(stream_id2);
}

Powered by Google App Engine
This is Rietveld 408576698