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

Side by Side Diff: chrome/renderer/media/audio_renderer_impl_unittest.cc

Issue 6171009: Remove MessageLoop methods from Filter interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied more CR suggestions & removed message_loop() methods where possible. Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/callback.h" 5 #include "base/callback.h"
6 #include "base/process_util.h" 6 #include "base/process_util.h"
7 #include "chrome/common/render_messages.h" 7 #include "chrome/common/render_messages.h"
8 #include "chrome/common/render_messages_params.h" 8 #include "chrome/common/render_messages_params.h"
9 #include "chrome/renderer/media/audio_renderer_impl.h" 9 #include "chrome/renderer/media/audio_renderer_impl.h"
10 #include "media/base/data_buffer.h" 10 #include "media/base/data_buffer.h"
(...skipping 30 matching lines...) Expand all
41 media::mime_type::kUncompressedAudio); 41 media::mime_type::kUncompressedAudio);
42 decoder_media_format_.SetAsInteger(media::MediaFormat::kChannels, 2); 42 decoder_media_format_.SetAsInteger(media::MediaFormat::kChannels, 2);
43 decoder_media_format_.SetAsInteger(media::MediaFormat::kSampleRate, 48000); 43 decoder_media_format_.SetAsInteger(media::MediaFormat::kSampleRate, 48000);
44 decoder_media_format_.SetAsInteger(media::MediaFormat::kSampleBits, 16); 44 decoder_media_format_.SetAsInteger(media::MediaFormat::kSampleBits, 16);
45 EXPECT_CALL(*decoder_, media_format()) 45 EXPECT_CALL(*decoder_, media_format())
46 .WillRepeatedly(ReturnRef(decoder_media_format_)); 46 .WillRepeatedly(ReturnRef(decoder_media_format_));
47 47
48 // Create and initialize audio renderer. 48 // Create and initialize audio renderer.
49 renderer_ = new AudioRendererImpl(filter_); 49 renderer_ = new AudioRendererImpl(filter_);
50 renderer_->set_host(&host_); 50 renderer_->set_host(&host_);
51 renderer_->set_message_loop(message_loop_.get());
52 renderer_->Initialize(decoder_, callback_.NewCallback()); 51 renderer_->Initialize(decoder_, callback_.NewCallback());
53 52
54 // Run pending tasks and simulate responding with a created audio stream. 53 // Run pending tasks and simulate responding with a created audio stream.
55 message_loop_->RunAllPending(); 54 message_loop_->RunAllPending();
56 55
57 // Duplicate the shared memory handle so both the test and the callee can 56 // Duplicate the shared memory handle so both the test and the callee can
58 // close their copy. 57 // close their copy.
59 base::SharedMemoryHandle duplicated_handle; 58 base::SharedMemoryHandle duplicated_handle;
60 EXPECT_TRUE(shared_mem_.ShareToProcess(base::GetCurrentProcessHandle(), 59 EXPECT_TRUE(shared_mem_.ShareToProcess(base::GetCurrentProcessHandle(),
61 &duplicated_handle)); 60 &duplicated_handle));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 149 }
151 150
152 TEST_F(AudioRendererImplTest, DestroyedMessageLoop_ConsumeAudioSamples) { 151 TEST_F(AudioRendererImplTest, DestroyedMessageLoop_ConsumeAudioSamples) {
153 // Kill the message loop and verify OnReadComplete() still works. 152 // Kill the message loop and verify OnReadComplete() still works.
154 message_loop_.reset(); 153 message_loop_.reset();
155 scoped_refptr<media::Buffer> buffer(new media::DataBuffer(kSize)); 154 scoped_refptr<media::Buffer> buffer(new media::DataBuffer(kSize));
156 renderer_->ConsumeAudioSamples(buffer); 155 renderer_->ConsumeAudioSamples(buffer);
157 EXPECT_CALL(stop_callback_, OnFilterCallback()); 156 EXPECT_CALL(stop_callback_, OnFilterCallback());
158 renderer_->Stop(stop_callback_.NewCallback()); 157 renderer_->Stop(stop_callback_.NewCallback());
159 } 158 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698