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

Side by Side Diff: media/base/mock_filters.h

Issue 5744002: Refactor PipelineImpl to use CompositeFilter to manage Filter state transitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add explicit MessageLoop usage to make sure code is running on the expected threads. Created 10 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) 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 // A new breed of mock media filters, this time using gmock! Feel free to add 5 // A new breed of mock media filters, this time using gmock! Feel free to add
6 // actions if you need interesting side-effects (i.e., copying data to the 6 // actions if you need interesting side-effects (i.e., copying data to the
7 // buffer passed into MockDataSource::Read()). 7 // buffer passed into MockDataSource::Read()).
8 // 8 //
9 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock 9 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock
10 // filters to fail the test or do nothing when an unexpected method is called. 10 // filters to fail the test or do nothing when an unexpected method is called.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 private: 84 private:
85 MockFilterCallback* mock_callback_; 85 MockFilterCallback* mock_callback_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(CallbackImpl); 87 DISALLOW_COPY_AND_ASSIGN(CallbackImpl);
88 }; 88 };
89 89
90 DISALLOW_COPY_AND_ASSIGN(MockFilterCallback); 90 DISALLOW_COPY_AND_ASSIGN(MockFilterCallback);
91 }; 91 };
92 92
93 class MockFilter : public Filter {
94 public:
95 MockFilter();
96
97 void set_requires_message_loop(bool requires_message_loop);
scherkus (not reviewing) 2010/12/15 16:44:02 looks like these are always called after creation.
acolwell GONE FROM CHROMIUM 2010/12/15 18:20:11 Done.
98 void set_message_loop_name(const char* name);
99
100 // Filter implementation.
101 virtual bool requires_message_loop() const;
102 virtual const char* message_loop_name() const;
103
104 MOCK_METHOD1(Play, void(FilterCallback* callback));
105 MOCK_METHOD1(Pause, void(FilterCallback* callback));
106 MOCK_METHOD1(Flush, void(FilterCallback* callback));
107 MOCK_METHOD1(Stop, void(FilterCallback* callback));
108 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
109 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback));
110 MOCK_METHOD0(OnAudioRendererDisabled, void());
111
112 protected:
113 virtual ~MockFilter();
114
115 private:
116 bool requires_message_loop_;
117 std::string message_loop_name_;
118
119 DISALLOW_COPY_AND_ASSIGN(MockFilter);
120 };
121
93 class MockDataSource : public DataSource { 122 class MockDataSource : public DataSource {
94 public: 123 public:
95 MockDataSource() {} 124 MockDataSource() {}
96 125
97 // Filter implementation. 126 // Filter implementation.
98 MOCK_METHOD1(Stop, void(FilterCallback* callback)); 127 MOCK_METHOD1(Stop, void(FilterCallback* callback));
99 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); 128 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
100 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback)); 129 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback));
101 MOCK_METHOD0(OnAudioRendererDisabled, void()); 130 MOCK_METHOD0(OnAudioRendererDisabled, void());
102 131
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 383
355 // Helper gmock action that calls DisableAudioRenderer() on behalf of the 384 // Helper gmock action that calls DisableAudioRenderer() on behalf of the
356 // provided filter. 385 // provided filter.
357 ACTION_P(DisableAudioRenderer, filter) { 386 ACTION_P(DisableAudioRenderer, filter) {
358 filter->host()->DisableAudioRenderer(); 387 filter->host()->DisableAudioRenderer();
359 } 388 }
360 389
361 } // namespace media 390 } // namespace media
362 391
363 #endif // MEDIA_BASE_MOCK_FILTERS_H_ 392 #endif // MEDIA_BASE_MOCK_FILTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698