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

Side by Side Diff: content/browser/renderer_host/media/audio_renderer_host_unittest.cc

Issue 8872030: Removing MessageLoop::QuitTask() from content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix escaping Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/bind.h" 5 #include "base/bind.h"
6 #include "base/environment.h" 6 #include "base/environment.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/sync_socket.h" 10 #include "base/sync_socket.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 157
158 scoped_ptr<base::SharedMemory> shared_memory_; 158 scoped_ptr<base::SharedMemory> shared_memory_;
159 scoped_ptr<base::SyncSocket> sync_socket_; 159 scoped_ptr<base::SyncSocket> sync_socket_;
160 uint32 shared_memory_length_; 160 uint32 shared_memory_length_;
161 161
162 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererHost); 162 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererHost);
163 }; 163 };
164 164
165 ACTION_P(QuitMessageLoop, message_loop) { 165 ACTION_P(QuitMessageLoop, message_loop) {
166 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 166 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
167 } 167 }
168 168
169 class AudioRendererHostTest : public testing::Test { 169 class AudioRendererHostTest : public testing::Test {
170 public: 170 public:
171 AudioRendererHostTest() 171 AudioRendererHostTest()
172 : mock_stream_(true) { 172 : mock_stream_(true) {
173 } 173 }
174 174
175 protected: 175 protected:
176 virtual void SetUp() { 176 virtual void SetUp() {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // Simulate an error sent from the audio device. 327 // Simulate an error sent from the audio device.
328 host_->OnError(controller, 0); 328 host_->OnError(controller, 0);
329 SyncWithAudioThread(); 329 SyncWithAudioThread();
330 330
331 // Expect the audio stream record is removed. 331 // Expect the audio stream record is removed.
332 EXPECT_EQ(0u, host_->audio_entries_.size()); 332 EXPECT_EQ(0u, host_->audio_entries_.size());
333 } 333 }
334 334
335 // Called on the audio thread. 335 // Called on the audio thread.
336 static void PostQuitMessageLoop(MessageLoop* message_loop) { 336 static void PostQuitMessageLoop(MessageLoop* message_loop) {
337 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 337 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
338 } 338 }
339 339
340 // Called on the main thread. 340 // Called on the main thread.
341 static void PostQuitOnAudioThread(MessageLoop* message_loop) { 341 static void PostQuitOnAudioThread(MessageLoop* message_loop) {
342 AudioManager::GetAudioManager()->GetMessageLoop()->PostTask( 342 AudioManager::GetAudioManager()->GetMessageLoop()->PostTask(
343 FROM_HERE, base::Bind(&PostQuitMessageLoop, message_loop)); 343 FROM_HERE, base::Bind(&PostQuitMessageLoop, message_loop));
344 } 344 }
345 345
346 // SyncWithAudioThread() waits until all pending tasks on the audio thread 346 // SyncWithAudioThread() waits until all pending tasks on the audio thread
347 // are executed while also processing pending task in message_loop_ on the 347 // are executed while also processing pending task in message_loop_ on the
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 497
498 // Simulate the case where a stream is not properly closed. 498 // Simulate the case where a stream is not properly closed.
499 TEST_F(AudioRendererHostTest, CreateLowLatencyAndShutdown) { 499 TEST_F(AudioRendererHostTest, CreateLowLatencyAndShutdown) {
500 if (!IsRunningHeadless()) 500 if (!IsRunningHeadless())
501 EnableRealDevice(); 501 EnableRealDevice();
502 502
503 CreateLowLatency(); 503 CreateLowLatency();
504 } 504 }
505 505
506 // TODO(hclam): Add tests for data conversation in low latency mode. 506 // TODO(hclam): Add tests for data conversation in low latency mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698