| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ |
| 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ | 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "extensions/browser/api/cast_channel/cast_socket.h" | 10 #include "extensions/browser/api/cast_channel/cast_socket.h" |
| 11 #include "extensions/browser/api/cast_channel/cast_transport.h" | 11 #include "extensions/browser/api/cast_channel/cast_transport.h" |
| 12 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 12 #include "extensions/common/api/cast_channel/cast_channel.pb.h" |
| 13 #include "net/base/ip_endpoint.h" | 13 #include "net/base/ip_endpoint.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 namespace core_api { | 17 namespace api { |
| 18 namespace cast_channel { | 18 namespace cast_channel { |
| 19 | 19 |
| 20 extern const char kTestExtensionId[]; | 20 extern const char kTestExtensionId[]; |
| 21 | 21 |
| 22 class MockCastTransport | 22 class MockCastTransport : public extensions::api::cast_channel::CastTransport { |
| 23 : public extensions::core_api::cast_channel::CastTransport { | |
| 24 public: | 23 public: |
| 25 MockCastTransport(); | 24 MockCastTransport(); |
| 26 ~MockCastTransport() override; | 25 ~MockCastTransport() override; |
| 27 | 26 |
| 28 void SetReadDelegate(scoped_ptr<CastTransport::Delegate> delegate) override; | 27 void SetReadDelegate(scoped_ptr<CastTransport::Delegate> delegate) override; |
| 29 | 28 |
| 30 MOCK_METHOD2( | 29 MOCK_METHOD2(SendMessage, |
| 31 SendMessage, | 30 void(const extensions::api::cast_channel::CastMessage& message, |
| 32 void(const extensions::core_api::cast_channel::CastMessage& message, | 31 const net::CompletionCallback& callback)); |
| 33 const net::CompletionCallback& callback)); | |
| 34 | 32 |
| 35 MOCK_METHOD0(Start, void(void)); | 33 MOCK_METHOD0(Start, void(void)); |
| 36 | 34 |
| 37 // Gets the read delegate that is currently active for this transport. | 35 // Gets the read delegate that is currently active for this transport. |
| 38 CastTransport::Delegate* current_delegate() const; | 36 CastTransport::Delegate* current_delegate() const; |
| 39 | 37 |
| 40 private: | 38 private: |
| 41 scoped_ptr<CastTransport::Delegate> delegate_; | 39 scoped_ptr<CastTransport::Delegate> delegate_; |
| 42 | 40 |
| 43 DISALLOW_COPY_AND_ASSIGN(MockCastTransport); | 41 DISALLOW_COPY_AND_ASSIGN(MockCastTransport); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return expected_serialized == actual_serialized; | 108 return expected_serialized == actual_serialized; |
| 111 } | 109 } |
| 112 | 110 |
| 113 ACTION_TEMPLATE(RunCompletionCallback, | 111 ACTION_TEMPLATE(RunCompletionCallback, |
| 114 HAS_1_TEMPLATE_PARAMS(int, cb_idx), | 112 HAS_1_TEMPLATE_PARAMS(int, cb_idx), |
| 115 AND_1_VALUE_PARAMS(rv)) { | 113 AND_1_VALUE_PARAMS(rv)) { |
| 116 testing::get<cb_idx>(args).Run(rv); | 114 testing::get<cb_idx>(args).Run(rv); |
| 117 } | 115 } |
| 118 | 116 |
| 119 } // namespace cast_channel | 117 } // namespace cast_channel |
| 120 } // namespace core_api | 118 } // namespace api |
| 121 } // namespace extensions | 119 } // namespace extensions |
| 122 | 120 |
| 123 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ | 121 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ |
| OLD | NEW |