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 COMPONENTS_CAST_CHANNEL_CAST_TEST_UTIL_H_ |
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ | 6 #define COMPONENTS_CAST_CHANNEL_CAST_TEST_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
13 #include "extensions/browser/api/cast_channel/cast_socket.h" | 13 #include "components/cast_channel/cast_socket.h" |
14 #include "extensions/browser/api/cast_channel/cast_transport.h" | 14 #include "components/cast_channel/cast_transport.h" |
15 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 15 #include "components/cast_channel/proto/cast_channel.pb.h" |
16 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 | 18 |
19 namespace extensions { | |
20 namespace api { | |
21 namespace cast_channel { | 19 namespace cast_channel { |
22 | 20 |
23 extern const char kTestExtensionId[]; | 21 class MockCastTransport : public CastTransport { |
24 | |
25 class MockCastTransport : public extensions::api::cast_channel::CastTransport { | |
26 public: | 22 public: |
27 MockCastTransport(); | 23 MockCastTransport(); |
28 ~MockCastTransport() override; | 24 ~MockCastTransport() override; |
29 | 25 |
30 void SetReadDelegate( | 26 void SetReadDelegate( |
31 std::unique_ptr<CastTransport::Delegate> delegate) override; | 27 std::unique_ptr<CastTransport::Delegate> delegate) override; |
32 | 28 |
33 MOCK_METHOD2(SendMessage, | 29 MOCK_METHOD2(SendMessage, |
34 void(const extensions::api::cast_channel::CastMessage& message, | 30 void(const CastMessage& message, |
35 const net::CompletionCallback& callback)); | 31 const net::CompletionCallback& callback)); |
36 | 32 |
37 MOCK_METHOD0(Start, void(void)); | 33 MOCK_METHOD0(Start, void(void)); |
38 | 34 |
39 // Gets the read delegate that is currently active for this transport. | 35 // Gets the read delegate that is currently active for this transport. |
40 CastTransport::Delegate* current_delegate() const; | 36 CastTransport::Delegate* current_delegate() const; |
41 | 37 |
42 private: | 38 private: |
43 std::unique_ptr<CastTransport::Delegate> delegate_; | 39 std::unique_ptr<CastTransport::Delegate> delegate_; |
44 | 40 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 110 } |
115 | 111 |
116 ACTION_TEMPLATE(PostCompletionCallbackTask, | 112 ACTION_TEMPLATE(PostCompletionCallbackTask, |
117 HAS_1_TEMPLATE_PARAMS(int, cb_idx), | 113 HAS_1_TEMPLATE_PARAMS(int, cb_idx), |
118 AND_1_VALUE_PARAMS(rv)) { | 114 AND_1_VALUE_PARAMS(rv)) { |
119 base::ThreadTaskRunnerHandle::Get()->PostTask( | 115 base::ThreadTaskRunnerHandle::Get()->PostTask( |
120 FROM_HERE, base::Bind(testing::get<cb_idx>(args), rv)); | 116 FROM_HERE, base::Bind(testing::get<cb_idx>(args), rv)); |
121 } | 117 } |
122 | 118 |
123 } // namespace cast_channel | 119 } // namespace cast_channel |
124 } // namespace api | |
125 } // namespace extensions | |
126 | 120 |
127 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ | 121 #endif // COMPONENTS_CAST_CHANNEL_CAST_TEST_UTIL_H_ |
OLD | NEW |