Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "media/base/filter_collection.h" | 5 #include "media/base/filter_collection.h" |
| 6 #include "media/base/mock_filters.h" | 6 #include "media/base/mock_filters.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 | 10 |
| 11 class FilterCollectionTest : public ::testing::Test { | 11 class FilterCollectionTest : public ::testing::Test { |
| 12 public: | 12 public: |
| 13 FilterCollectionTest() {} | 13 FilterCollectionTest() {} |
| 14 virtual ~FilterCollectionTest() {} | 14 virtual ~FilterCollectionTest() {} |
| 15 | 15 |
| 16 protected: | 16 protected: |
| 17 FilterCollection collection_; | 17 FilterCollection collection_; |
| 18 MockFilterCollection mock_filters_; | 18 MockFilterCollection mock_filters_; |
| 19 | 19 |
| 20 DISALLOW_COPY_AND_ASSIGN(FilterCollectionTest); | 20 DISALLOW_COPY_AND_ASSIGN(FilterCollectionTest); |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 TEST_F(FilterCollectionTest, SelectXXXMethods) { | 23 TEST_F(FilterCollectionTest, SelectXXXMethods) { |
|
acolwell GONE FROM CHROMIUM
2012/10/15 21:00:07
Are these tests really worth having anymore? We ke
xhwang
2012/10/15 22:52:23
I am totally fine with removing them. But I'd wait
| |
| 24 scoped_refptr<AudioDecoder> audio_decoder; | 24 scoped_refptr<AudioRenderer> audio_renderer; |
| 25 | 25 |
| 26 collection_.SelectAudioDecoder(&audio_decoder); | 26 collection_.SelectAudioRenderer(&audio_renderer); |
| 27 EXPECT_FALSE(audio_decoder); | 27 EXPECT_FALSE(audio_renderer); |
| 28 | 28 |
| 29 // Add an audio decoder. | 29 // Add an audio decoder. |
| 30 collection_.AddAudioDecoder(mock_filters_.audio_decoder()); | 30 collection_.AddAudioRenderer(mock_filters_.audio_renderer()); |
| 31 | 31 |
| 32 // Verify that we can select the audio decoder. | 32 // Verify that we can select the audio decoder. |
| 33 collection_.SelectAudioDecoder(&audio_decoder); | 33 collection_.SelectAudioRenderer(&audio_renderer); |
| 34 EXPECT_TRUE(audio_decoder); | 34 EXPECT_TRUE(audio_renderer); |
| 35 | 35 |
| 36 // Verify that we can't select it again since only one has been added. | 36 // Verify that we can't select it again since only one has been added. |
| 37 collection_.SelectAudioDecoder(&audio_decoder); | 37 collection_.SelectAudioRenderer(&audio_renderer); |
| 38 EXPECT_FALSE(audio_decoder); | 38 EXPECT_FALSE(audio_renderer); |
| 39 } | 39 } |
| 40 | 40 |
| 41 TEST_F(FilterCollectionTest, MultipleFiltersOfSameType) { | 41 TEST_F(FilterCollectionTest, MultipleFiltersOfSameType) { |
| 42 scoped_refptr<AudioDecoder> audio_decoder_a(new MockAudioDecoder()); | 42 scoped_refptr<AudioRenderer> audio_renderer_a(new MockAudioRenderer()); |
| 43 scoped_refptr<AudioDecoder> audio_decoder_b(new MockAudioDecoder()); | 43 scoped_refptr<AudioRenderer> audio_renderer_b(new MockAudioRenderer()); |
| 44 | 44 |
| 45 scoped_refptr<AudioDecoder> audio_decoder; | 45 scoped_refptr<AudioRenderer> audio_renderer; |
| 46 | 46 |
| 47 collection_.AddAudioDecoder(audio_decoder_a.get()); | 47 collection_.AddAudioRenderer(audio_renderer_a.get()); |
| 48 collection_.AddAudioDecoder(audio_decoder_b.get()); | 48 collection_.AddAudioRenderer(audio_renderer_b.get()); |
| 49 | 49 |
| 50 // Verify that first SelectAudioDecoder() returns audio_decoder_a. | 50 // Verify that first SelectAudioRenderer() returns audio_renderer_a. |
| 51 collection_.SelectAudioDecoder(&audio_decoder); | 51 collection_.SelectAudioRenderer(&audio_renderer); |
| 52 EXPECT_TRUE(audio_decoder); | 52 EXPECT_TRUE(audio_renderer); |
| 53 EXPECT_EQ(audio_decoder, audio_decoder_a); | 53 EXPECT_EQ(audio_renderer, audio_renderer_a); |
| 54 | 54 |
| 55 // Verify that second SelectAudioDecoder() returns audio_decoder_b. | 55 // Verify that second SelectAudioRenderer() returns audio_renderer_b. |
| 56 collection_.SelectAudioDecoder(&audio_decoder); | 56 collection_.SelectAudioRenderer(&audio_renderer); |
| 57 EXPECT_TRUE(audio_decoder); | 57 EXPECT_TRUE(audio_renderer); |
| 58 EXPECT_EQ(audio_decoder, audio_decoder_b); | 58 EXPECT_EQ(audio_renderer, audio_renderer_b); |
| 59 | 59 |
| 60 // Verify that third SelectAudioDecoder() returns nothing. | 60 // Verify that third SelectAudioRenderer() returns nothing. |
| 61 collection_.SelectAudioDecoder(&audio_decoder); | 61 collection_.SelectAudioRenderer(&audio_renderer); |
| 62 EXPECT_FALSE(audio_decoder); | 62 EXPECT_FALSE(audio_renderer); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace media | 65 } // namespace media |
| OLD | NEW |