| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 // Helper gmock function that immediately destroys the FilterCallback on behalf | 329 // Helper gmock function that immediately destroys the FilterCallback on behalf |
| 330 // of the provided filter. Can be used when mocking the Initialize() and Seek() | 330 // of the provided filter. Can be used when mocking the Initialize() and Seek() |
| 331 // methods. | 331 // methods. |
| 332 void DestroyFilterCallback(::testing::Unused, FilterCallback* callback); | 332 void DestroyFilterCallback(::testing::Unused, FilterCallback* callback); |
| 333 | 333 |
| 334 // Helper gmock action that calls SetError() on behalf of the provided filter. | 334 // Helper gmock action that calls SetError() on behalf of the provided filter. |
| 335 ACTION_P2(SetError, filter, error) { | 335 ACTION_P2(SetError, filter, error) { |
| 336 filter->host()->SetError(error); | 336 filter->host()->SetError(error); |
| 337 } | 337 } |
| 338 | 338 |
| 339 // Helper gmock action that calls SetDuration() on behalf of the provided |
| 340 // filter. |
| 341 ACTION_P2(SetDuration, filter, duration) { |
| 342 filter->host()->SetDuration(duration); |
| 343 } |
| 344 |
| 339 } // namespace media | 345 } // namespace media |
| 340 | 346 |
| 341 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 347 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |