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

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

Issue 6171009: Remove MessageLoop methods from Filter interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied more CR suggestions & removed message_loop() methods where possible. Created 9 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/base/message_loop_factory_impl.cc ('k') | media/base/mock_filters.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 // 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 DISALLOW_COPY_AND_ASSIGN(CallbackImpl); 90 DISALLOW_COPY_AND_ASSIGN(CallbackImpl);
91 }; 91 };
92 92
93 bool run_destroy_callback_; 93 bool run_destroy_callback_;
94 DISALLOW_COPY_AND_ASSIGN(MockFilterCallback); 94 DISALLOW_COPY_AND_ASSIGN(MockFilterCallback);
95 }; 95 };
96 96
97 class MockFilter : public Filter { 97 class MockFilter : public Filter {
98 public: 98 public:
99 MockFilter(); 99 MockFilter();
100 MockFilter(bool requires_message_loop);
101 100
102 // Filter implementation. 101 // Filter implementation.
103 virtual bool requires_message_loop() const;
104 virtual const char* message_loop_name() const;
105
106 MOCK_METHOD1(Play, void(FilterCallback* callback)); 102 MOCK_METHOD1(Play, void(FilterCallback* callback));
107 MOCK_METHOD1(Pause, void(FilterCallback* callback)); 103 MOCK_METHOD1(Pause, void(FilterCallback* callback));
108 MOCK_METHOD1(Flush, void(FilterCallback* callback)); 104 MOCK_METHOD1(Flush, void(FilterCallback* callback));
109 MOCK_METHOD1(Stop, void(FilterCallback* callback)); 105 MOCK_METHOD1(Stop, void(FilterCallback* callback));
110 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); 106 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
111 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback)); 107 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback));
112 MOCK_METHOD0(OnAudioRendererDisabled, void()); 108 MOCK_METHOD0(OnAudioRendererDisabled, void());
113 109
114 protected: 110 protected:
115 virtual ~MockFilter(); 111 virtual ~MockFilter();
116 112
117 private: 113 private:
118
119 bool requires_message_loop_;
120
121 DISALLOW_COPY_AND_ASSIGN(MockFilter); 114 DISALLOW_COPY_AND_ASSIGN(MockFilter);
122 }; 115 };
123 116
124 class MockDataSource : public DataSource { 117 class MockDataSource : public DataSource {
125 public: 118 public:
126 MockDataSource(); 119 MockDataSource();
127 120
128 // Filter implementation. 121 // Filter implementation.
129 MOCK_METHOD1(Stop, void(FilterCallback* callback)); 122 MOCK_METHOD1(Stop, void(FilterCallback* callback));
130 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); 123 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 358
366 // Helper gmock action that calls DisableAudioRenderer() on behalf of the 359 // Helper gmock action that calls DisableAudioRenderer() on behalf of the
367 // provided filter. 360 // provided filter.
368 ACTION_P(DisableAudioRenderer, filter) { 361 ACTION_P(DisableAudioRenderer, filter) {
369 filter->host()->DisableAudioRenderer(); 362 filter->host()->DisableAudioRenderer();
370 } 363 }
371 364
372 } // namespace media 365 } // namespace media
373 366
374 #endif // MEDIA_BASE_MOCK_FILTERS_H_ 367 #endif // MEDIA_BASE_MOCK_FILTERS_H_
OLDNEW
« no previous file with comments | « media/base/message_loop_factory_impl.cc ('k') | media/base/mock_filters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698