| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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. | 6 // actions if you need interesting side-effects. |
| 7 // | 7 // |
| 8 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock | 8 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock |
| 9 // filters to fail the test or do nothing when an unexpected method is called. | 9 // filters to fail the test or do nothing when an unexpected method is called. |
| 10 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks | 10 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); | 191 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 class MockDecryptor : public Decryptor { | 194 class MockDecryptor : public Decryptor { |
| 195 public: | 195 public: |
| 196 MockDecryptor(); | 196 MockDecryptor(); |
| 197 virtual ~MockDecryptor(); | 197 virtual ~MockDecryptor(); |
| 198 | 198 |
| 199 MOCK_METHOD3(GenerateKeyRequest, bool(const std::string& key_system, | 199 MOCK_METHOD4(GenerateKeyRequest, bool(const std::string& key_system, |
| 200 const std::string& type, |
| 200 const uint8* init_data, | 201 const uint8* init_data, |
| 201 int init_data_length)); | 202 int init_data_length)); |
| 202 MOCK_METHOD6(AddKey, void(const std::string& key_system, | 203 MOCK_METHOD6(AddKey, void(const std::string& key_system, |
| 203 const uint8* key, | 204 const uint8* key, |
| 204 int key_length, | 205 int key_length, |
| 205 const uint8* init_data, | 206 const uint8* init_data, |
| 206 int init_data_length, | 207 int init_data_length, |
| 207 const std::string& session_id)); | 208 const std::string& session_id)); |
| 208 MOCK_METHOD2(CancelKeyRequest, void(const std::string& key_system, | 209 MOCK_METHOD2(CancelKeyRequest, void(const std::string& key_system, |
| 209 const std::string& session_id)); | 210 const std::string& session_id)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 Decryptor::KeyError, int)); | 253 Decryptor::KeyError, int)); |
| 253 // TODO(xhwang): This is a workaround of the issue that move-only parameters | 254 // TODO(xhwang): This is a workaround of the issue that move-only parameters |
| 254 // are not supported in mocked methods. Remove this when the issue is fixed | 255 // are not supported in mocked methods. Remove this when the issue is fixed |
| 255 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use | 256 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use |
| 256 // std::string instead of scoped_array<uint8> (http://crbug.com/130689). | 257 // std::string instead of scoped_array<uint8> (http://crbug.com/130689). |
| 257 MOCK_METHOD5(KeyMessageMock, void(const std::string& key_system, | 258 MOCK_METHOD5(KeyMessageMock, void(const std::string& key_system, |
| 258 const std::string& session_id, | 259 const std::string& session_id, |
| 259 const uint8* message, | 260 const uint8* message, |
| 260 int message_length, | 261 int message_length, |
| 261 const std::string& default_url)); | 262 const std::string& default_url)); |
| 262 MOCK_METHOD4(NeedKeyMock, void(const std::string& key_system, | 263 MOCK_METHOD5(NeedKeyMock, void(const std::string& key_system, |
| 263 const std::string& session_id, | 264 const std::string& session_id, |
| 265 const std::string& type, |
| 264 const uint8* init_data, | 266 const uint8* init_data, |
| 265 int init_data_length)); | 267 int init_data_length)); |
| 266 virtual void KeyMessage(const std::string& key_system, | 268 virtual void KeyMessage(const std::string& key_system, |
| 267 const std::string& session_id, | 269 const std::string& session_id, |
| 268 scoped_array<uint8> message, | 270 scoped_array<uint8> message, |
| 269 int message_length, | 271 int message_length, |
| 270 const std::string& default_url) OVERRIDE; | 272 const std::string& default_url) OVERRIDE; |
| 271 virtual void NeedKey(const std::string& key_system, | 273 virtual void NeedKey(const std::string& key_system, |
| 272 const std::string& session_id, | 274 const std::string& session_id, |
| 275 const std::string& type, |
| 273 scoped_array<uint8> init_data, | 276 scoped_array<uint8> init_data, |
| 274 int init_data_length) OVERRIDE; | 277 int init_data_length) OVERRIDE; |
| 275 | 278 |
| 276 private: | 279 private: |
| 277 DISALLOW_COPY_AND_ASSIGN(MockDecryptorClient); | 280 DISALLOW_COPY_AND_ASSIGN(MockDecryptorClient); |
| 278 }; | 281 }; |
| 279 | 282 |
| 280 // FilterFactory that returns canned instances of mock filters. You can set | 283 // FilterFactory that returns canned instances of mock filters. You can set |
| 281 // expectations on the filters and then pass the collection into a pipeline. | 284 // expectations on the filters and then pass the collection into a pipeline. |
| 282 class MockFilterCollection { | 285 class MockFilterCollection { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 313 public: | 316 public: |
| 314 MockStatisticsCB(); | 317 MockStatisticsCB(); |
| 315 ~MockStatisticsCB(); | 318 ~MockStatisticsCB(); |
| 316 | 319 |
| 317 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 320 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
| 318 }; | 321 }; |
| 319 | 322 |
| 320 } // namespace media | 323 } // namespace media |
| 321 | 324 |
| 322 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 325 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |