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

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

Issue 66183002: Replace MessageLoopProxy with SingleThreadTaskRunner for the rest of media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/message_loop.h"
6 #include "base/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
7 #include "media/audio/linux/alsa_output.h" 6 #include "media/audio/linux/alsa_output.h"
8 #include "media/audio/linux/alsa_wrapper.h" 7 #include "media/audio/linux/alsa_wrapper.h"
9 #include "media/audio/linux/audio_manager_linux.h" 8 #include "media/audio/linux/audio_manager_linux.h"
10 #include "media/base/data_buffer.h" 9 #include "media/base/data_buffer.h"
11 #include "media/base/seekable_buffer.h" 10 #include "media/base/seekable_buffer.h"
12 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
14 13
15 using testing::_; 14 using testing::_;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // We need to override this function in order to skip the checking the number 92 // We need to override this function in order to skip the checking the number
94 // of active output streams. It is because the number of active streams 93 // of active output streams. It is because the number of active streams
95 // is managed inside MakeAudioOutputStream, and we don't use 94 // is managed inside MakeAudioOutputStream, and we don't use
96 // MakeAudioOutputStream to create the stream in the tests. 95 // MakeAudioOutputStream to create the stream in the tests.
97 virtual void ReleaseOutputStream(AudioOutputStream* stream) OVERRIDE { 96 virtual void ReleaseOutputStream(AudioOutputStream* stream) OVERRIDE {
98 DCHECK(stream); 97 DCHECK(stream);
99 delete stream; 98 delete stream;
100 } 99 }
101 100
102 // We don't mock this method since all tests will do the same thing 101 // We don't mock this method since all tests will do the same thing
103 // and use the current message loop. 102 // and use the current task runner.
104 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE { 103 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() OVERRIDE {
105 return base::MessageLoop::current()->message_loop_proxy(); 104 return base::MessageLoop::current()->message_loop_proxy();
106 } 105 }
107 }; 106 };
108 107
109 class AlsaPcmOutputStreamTest : public testing::Test { 108 class AlsaPcmOutputStreamTest : public testing::Test {
110 protected: 109 protected:
111 AlsaPcmOutputStreamTest() { 110 AlsaPcmOutputStreamTest() {
112 mock_manager_.reset(new StrictMock<MockAudioManagerLinux>()); 111 mock_manager_.reset(new StrictMock<MockAudioManagerLinux>());
113 } 112 }
114 113
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 860
862 // TODO(ajwong): Find a way to test whether or not another task has been 861 // TODO(ajwong): Find a way to test whether or not another task has been
863 // posted so we can verify that the Alsa code will indeed break the task 862 // posted so we can verify that the Alsa code will indeed break the task
864 // posting loop. 863 // posting loop.
865 864
866 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); 865 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed);
867 test_stream->Close(); 866 test_stream->Close();
868 } 867 }
869 868
870 } // namespace media 869 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698