| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // Helper gmock function that immediately executes and destroys the | 325 // Helper gmock function that immediately executes and destroys the |
| 326 // FilterCallback on behalf of the provided filter. Can be used when mocking | 326 // FilterCallback on behalf of the provided filter. Can be used when mocking |
| 327 // the Initialize() and Seek() methods. | 327 // the Initialize() and Seek() methods. |
| 328 void RunFilterCallback(::testing::Unused, FilterCallback* callback); | 328 void RunFilterCallback(::testing::Unused, FilterCallback* callback); |
| 329 | 329 |
| 330 // Helper gmock function that immediately destroys the FilterCallback on behalf | 330 // Helper gmock function that immediately destroys the FilterCallback on behalf |
| 331 // of the provided filter. Can be used when mocking the Initialize() and Seek() | 331 // of the provided filter. Can be used when mocking the Initialize() and Seek() |
| 332 // methods. | 332 // methods. |
| 333 void DestroyFilterCallback(::testing::Unused, FilterCallback* callback); | 333 void DestroyFilterCallback(::testing::Unused, FilterCallback* callback); |
| 334 | 334 |
| 335 // Helper gmock action that calls Error() on behalf of the provided filter. | 335 // Helper gmock action that calls SetError() on behalf of the provided filter. |
| 336 ACTION_P2(Error, filter, error) { | 336 ACTION_P2(SetError, filter, error) { |
| 337 filter->host()->Error(error); | 337 filter->host()->SetError(error); |
| 338 } | 338 } |
| 339 | 339 |
| 340 } // namespace media | 340 } // namespace media |
| 341 | 341 |
| 342 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 342 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |