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

Side by Side Diff: media/audio/linux/alsa_output_unittest.cc

Issue 9255017: Add thread safety to AudioManagerBase to protect access to the audio thread member variable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style issue Created 8 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 | « media/audio/linux/alsa_output.cc ('k') | media/audio/linux/audio_manager_linux.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) 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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/stringprintf.h" 6 #include "base/stringprintf.h"
7 #include "media/audio/linux/alsa_output.h" 7 #include "media/audio/linux/alsa_output.h"
8 #include "media/audio/linux/alsa_wrapper.h" 8 #include "media/audio/linux/alsa_wrapper.h"
9 #include "media/audio/linux/audio_manager_linux.h" 9 #include "media/audio/linux/audio_manager_linux.h"
10 #include "media/base/data_buffer.h" 10 #include "media/base/data_buffer.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 MOCK_METHOD1(MakeAudioOutputStream, AudioOutputStream*( 81 MOCK_METHOD1(MakeAudioOutputStream, AudioOutputStream*(
82 const AudioParameters& params)); 82 const AudioParameters& params));
83 MOCK_METHOD2(MakeAudioInputStream, AudioInputStream*( 83 MOCK_METHOD2(MakeAudioInputStream, AudioInputStream*(
84 const AudioParameters& params, const std::string& device_id)); 84 const AudioParameters& params, const std::string& device_id));
85 MOCK_METHOD0(MuteAll, void()); 85 MOCK_METHOD0(MuteAll, void());
86 MOCK_METHOD0(UnMuteAll, void()); 86 MOCK_METHOD0(UnMuteAll, void());
87 MOCK_METHOD1(ReleaseOutputStream, void(AudioOutputStream* stream)); 87 MOCK_METHOD1(ReleaseOutputStream, void(AudioOutputStream* stream));
88 88
89 // We don't mock this method since all tests will do the same thing 89 // We don't mock this method since all tests will do the same thing
90 // and use the current message loop. 90 // and use the current message loop.
91 virtual MessageLoop* GetMessageLoop() { 91 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE {
92 return MessageLoop::current(); 92 return MessageLoop::current()->message_loop_proxy();
93 } 93 }
94 }; 94 };
95 95
96 class AlsaPcmOutputStreamTest : public testing::Test { 96 class AlsaPcmOutputStreamTest : public testing::Test {
97 protected: 97 protected:
98 AlsaPcmOutputStreamTest() { 98 AlsaPcmOutputStreamTest() {
99 mock_manager_ = new StrictMock<MockAudioManagerLinux>(); 99 mock_manager_ = new StrictMock<MockAudioManagerLinux>();
100 test_stream_.reset(CreateStream(kTestChannelLayout)); 100 test_stream_.reset(CreateStream(kTestChannelLayout));
101 } 101 }
102 102
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 783
784 test_stream_->stop_stream_ = true; 784 test_stream_->stop_stream_ = true;
785 test_stream_->ScheduleNextWrite(true); 785 test_stream_->ScheduleNextWrite(true);
786 786
787 // TODO(ajwong): Find a way to test whether or not another task has been 787 // TODO(ajwong): Find a way to test whether or not another task has been
788 // posted so we can verify that the Alsa code will indeed break the task 788 // posted so we can verify that the Alsa code will indeed break the task
789 // posting loop. 789 // posting loop.
790 790
791 test_stream_->TransitionTo(AlsaPcmOutputStream::kIsClosed); 791 test_stream_->TransitionTo(AlsaPcmOutputStream::kIsClosed);
792 } 792 }
OLDNEW
« no previous file with comments | « media/audio/linux/alsa_output.cc ('k') | media/audio/linux/audio_manager_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698