Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 namespace media_router { | 24 namespace media_router { |
| 25 | 25 |
| 26 class MediaRouterMojoImpl; | 26 class MediaRouterMojoImpl; |
| 27 | 27 |
| 28 class MockMediaRouteProvider : public mojom::MediaRouteProvider { | 28 class MockMediaRouteProvider : public mojom::MediaRouteProvider { |
| 29 public: | 29 public: |
| 30 MockMediaRouteProvider(); | 30 MockMediaRouteProvider(); |
| 31 ~MockMediaRouteProvider() override; | 31 ~MockMediaRouteProvider() override; |
| 32 | 32 |
| 33 MOCK_METHOD8(CreateRoute, | 33 void CreateRoute(const std::string& source_urn, |
| 34 const std::string& sink_id, | |
| 35 const std::string& presentation_id, | |
| 36 const url::Origin& origin, | |
| 37 int tab_id, | |
| 38 base::TimeDelta timeout, | |
| 39 bool incognito, | |
| 40 CreateRouteCallback callback) { | |
| 41 CreateRouteInternal(source_urn, sink_id, presentation_id, origin, tab_id, | |
| 42 timeout, incognito, callback); | |
| 43 } | |
| 44 MOCK_METHOD8(CreateRouteInternal, | |
| 34 void(const std::string& source_urn, | 45 void(const std::string& source_urn, |
| 35 const std::string& sink_id, | 46 const std::string& sink_id, |
| 36 const std::string& presentation_id, | 47 const std::string& presentation_id, |
| 37 const url::Origin& origin, | 48 const url::Origin& origin, |
| 38 int tab_id, | 49 int tab_id, |
| 39 base::TimeDelta timeout, | 50 base::TimeDelta timeout, |
| 40 bool incognito, | 51 bool incognito, |
| 41 const CreateRouteCallback& callback)); | 52 CreateRouteCallback& callback)); |
|
dcheng
2017/05/29 09:30:22
Can this be done without using a mutable reference
tzik
2017/05/30 05:25:51
The move-only type support of gmock seems getting
| |
| 42 MOCK_METHOD7(JoinRoute, | 53 void JoinRoute(const std::string& source_urn, |
| 54 const std::string& presentation_id, | |
| 55 const url::Origin& origin, | |
| 56 int tab_id, | |
| 57 base::TimeDelta timeout, | |
| 58 bool incognito, | |
| 59 JoinRouteCallback callback) { | |
| 60 JoinRouteInternal(source_urn, presentation_id, origin, tab_id, timeout, | |
| 61 incognito, callback); | |
| 62 } | |
| 63 MOCK_METHOD7(JoinRouteInternal, | |
| 43 void(const std::string& source_urn, | 64 void(const std::string& source_urn, |
| 44 const std::string& presentation_id, | 65 const std::string& presentation_id, |
| 45 const url::Origin& origin, | 66 const url::Origin& origin, |
| 46 int tab_id, | 67 int tab_id, |
| 47 base::TimeDelta timeout, | 68 base::TimeDelta timeout, |
| 48 bool incognito, | 69 bool incognito, |
| 49 const JoinRouteCallback& callback)); | 70 JoinRouteCallback& callback)); |
| 50 MOCK_METHOD8(ConnectRouteByRouteId, | 71 void ConnectRouteByRouteId(const std::string& source_urn, |
| 72 const std::string& route_id, | |
| 73 const std::string& presentation_id, | |
| 74 const url::Origin& origin, | |
| 75 int tab_id, | |
| 76 base::TimeDelta timeout, | |
| 77 bool incognito, | |
| 78 JoinRouteCallback callback) { | |
| 79 ConnectRouteByRouteIdInternal(source_urn, route_id, presentation_id, origin, | |
| 80 tab_id, timeout, incognito, callback); | |
| 81 } | |
| 82 MOCK_METHOD8(ConnectRouteByRouteIdInternal, | |
| 51 void(const std::string& source_urn, | 83 void(const std::string& source_urn, |
| 52 const std::string& route_id, | 84 const std::string& route_id, |
| 53 const std::string& presentation_id, | 85 const std::string& presentation_id, |
| 54 const url::Origin& origin, | 86 const url::Origin& origin, |
| 55 int tab_id, | 87 int tab_id, |
| 56 base::TimeDelta timeout, | 88 base::TimeDelta timeout, |
| 57 bool incognito, | 89 bool incognito, |
| 58 const JoinRouteCallback& callback)); | 90 JoinRouteCallback& callback)); |
| 59 MOCK_METHOD1(DetachRoute, void(const std::string& route_id)); | 91 MOCK_METHOD1(DetachRoute, void(const std::string& route_id)); |
| 60 MOCK_METHOD2(TerminateRoute, void(const std::string& route_id, | 92 void TerminateRoute(const std::string& route_id, |
| 61 const TerminateRouteCallback& callback)); | 93 TerminateRouteCallback callback) { |
| 94 TerminateRouteInternal(route_id, callback); | |
| 95 } | |
| 96 MOCK_METHOD2(TerminateRouteInternal, | |
| 97 void(const std::string& route_id, | |
| 98 TerminateRouteCallback& callback)); | |
| 62 MOCK_METHOD1(StartObservingMediaSinks, void(const std::string& source)); | 99 MOCK_METHOD1(StartObservingMediaSinks, void(const std::string& source)); |
| 63 MOCK_METHOD1(StopObservingMediaSinks, void(const std::string& source)); | 100 MOCK_METHOD1(StopObservingMediaSinks, void(const std::string& source)); |
| 64 MOCK_METHOD3(SendRouteMessage, | 101 void SendRouteMessage(const std::string& media_route_id, |
| 102 const std::string& message, | |
| 103 SendRouteMessageCallback callback) { | |
| 104 SendRouteMessageInternal(media_route_id, message, callback); | |
| 105 } | |
| 106 MOCK_METHOD3(SendRouteMessageInternal, | |
| 65 void(const std::string& media_route_id, | 107 void(const std::string& media_route_id, |
| 66 const std::string& message, | 108 const std::string& message, |
| 67 const SendRouteMessageCallback& callback)); | 109 SendRouteMessageCallback& callback)); |
| 68 void SendRouteBinaryMessage( | 110 void SendRouteBinaryMessage(const std::string& media_route_id, |
| 69 const std::string& media_route_id, | 111 const std::vector<uint8_t>& data, |
| 70 const std::vector<uint8_t>& data, | 112 SendRouteMessageCallback callback) override { |
| 71 const SendRouteMessageCallback& callback) override { | |
| 72 SendRouteBinaryMessageInternal(media_route_id, data, callback); | 113 SendRouteBinaryMessageInternal(media_route_id, data, callback); |
| 73 } | 114 } |
| 74 MOCK_METHOD3(SendRouteBinaryMessageInternal, | 115 MOCK_METHOD3(SendRouteBinaryMessageInternal, |
| 75 void(const std::string& media_route_id, | 116 void(const std::string& media_route_id, |
| 76 const std::vector<uint8_t>& data, | 117 const std::vector<uint8_t>& data, |
| 77 const SendRouteMessageCallback& callback)); | 118 SendRouteMessageCallback& callback)); |
| 78 MOCK_METHOD1(StartListeningForRouteMessages, | 119 MOCK_METHOD1(StartListeningForRouteMessages, |
| 79 void(const std::string& route_id)); | 120 void(const std::string& route_id)); |
| 80 MOCK_METHOD1(StopListeningForRouteMessages, | 121 MOCK_METHOD1(StopListeningForRouteMessages, |
| 81 void(const std::string& route_id)); | 122 void(const std::string& route_id)); |
| 82 MOCK_METHOD1(OnPresentationSessionDetached, | 123 MOCK_METHOD1(OnPresentationSessionDetached, |
| 83 void(const std::string& route_id)); | 124 void(const std::string& route_id)); |
| 84 MOCK_METHOD1(StartObservingMediaRoutes, void(const std::string& source)); | 125 MOCK_METHOD1(StartObservingMediaRoutes, void(const std::string& source)); |
| 85 MOCK_METHOD1(StopObservingMediaRoutes, void(const std::string& source)); | 126 MOCK_METHOD1(StopObservingMediaRoutes, void(const std::string& source)); |
| 86 MOCK_METHOD0(EnableMdnsDiscovery, void()); | 127 MOCK_METHOD0(EnableMdnsDiscovery, void()); |
| 87 MOCK_METHOD1(UpdateMediaSinks, void(const std::string& source)); | 128 MOCK_METHOD1(UpdateMediaSinks, void(const std::string& source)); |
| 88 void SearchSinks( | 129 void SearchSinks(const std::string& sink_id, |
| 89 const std::string& sink_id, | 130 const std::string& media_source, |
| 90 const std::string& media_source, | 131 mojom::SinkSearchCriteriaPtr search_criteria, |
| 91 mojom::SinkSearchCriteriaPtr search_criteria, | 132 SearchSinksCallback callback) override { |
| 92 const SearchSinksCallback& callback) override { | |
| 93 SearchSinksInternal(sink_id, media_source, search_criteria, callback); | 133 SearchSinksInternal(sink_id, media_source, search_criteria, callback); |
| 94 } | 134 } |
| 95 MOCK_METHOD4(SearchSinksInternal, | 135 MOCK_METHOD4(SearchSinksInternal, |
| 96 void(const std::string& sink_id, | 136 void(const std::string& sink_id, |
| 97 const std::string& media_source, | 137 const std::string& media_source, |
| 98 mojom::SinkSearchCriteriaPtr& search_criteria, | 138 mojom::SinkSearchCriteriaPtr& search_criteria, |
| 99 const SearchSinksCallback& callback)); | 139 SearchSinksCallback& callback)); |
| 100 MOCK_METHOD2(ProvideSinks, | 140 MOCK_METHOD2(ProvideSinks, |
| 101 void(const std::string&, const std::vector<MediaSinkInternal>&)); | 141 void(const std::string&, const std::vector<MediaSinkInternal>&)); |
| 102 void CreateMediaRouteController( | 142 void CreateMediaRouteController( |
| 103 const std::string& route_id, | 143 const std::string& route_id, |
| 104 mojom::MediaControllerRequest media_controller, | 144 mojom::MediaControllerRequest media_controller, |
| 105 mojom::MediaStatusObserverPtr observer, | 145 mojom::MediaStatusObserverPtr observer, |
| 106 const CreateMediaRouteControllerCallback& callback) override { | 146 CreateMediaRouteControllerCallback callback) override { |
| 107 CreateMediaRouteControllerInternal(route_id, media_controller, observer, | 147 CreateMediaRouteControllerInternal(route_id, media_controller, observer, |
| 108 callback); | 148 callback); |
| 109 } | 149 } |
| 110 MOCK_METHOD4(CreateMediaRouteControllerInternal, | 150 MOCK_METHOD4(CreateMediaRouteControllerInternal, |
| 111 void(const std::string& route_id, | 151 void(const std::string& route_id, |
| 112 mojom::MediaControllerRequest& media_controller, | 152 mojom::MediaControllerRequest& media_controller, |
| 113 mojom::MediaStatusObserverPtr& observer, | 153 mojom::MediaStatusObserverPtr& observer, |
| 114 const CreateMediaRouteControllerCallback& callback)); | 154 CreateMediaRouteControllerCallback& callback)); |
| 115 | 155 |
| 116 private: | 156 private: |
| 117 DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider); | 157 DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider); |
| 118 }; | 158 }; |
| 119 | 159 |
| 120 class MockEventPageTracker : public extensions::EventPageTracker { | 160 class MockEventPageTracker : public extensions::EventPageTracker { |
| 121 public: | 161 public: |
| 122 MockEventPageTracker(); | 162 MockEventPageTracker(); |
| 123 ~MockEventPageTracker(); | 163 ~MockEventPageTracker(); |
| 124 | 164 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 TestingProfile profile_; | 265 TestingProfile profile_; |
| 226 std::unique_ptr<MediaRouterMojoImpl> mock_media_router_; | 266 std::unique_ptr<MediaRouterMojoImpl> mock_media_router_; |
| 227 std::unique_ptr<mojo::Binding<mojom::MediaRouteProvider>> binding_; | 267 std::unique_ptr<mojo::Binding<mojom::MediaRouteProvider>> binding_; |
| 228 | 268 |
| 229 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); | 269 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); |
| 230 }; | 270 }; |
| 231 | 271 |
| 232 } // namespace media_router | 272 } // namespace media_router |
| 233 | 273 |
| 234 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ | 274 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ |
| OLD | NEW |