| 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_TEST_HELPER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const mojo::String& presentation_id, | 94 const mojo::String& presentation_id, |
| 95 const mojo::String& origin, | 95 const mojo::String& origin, |
| 96 int tab_id, | 96 int tab_id, |
| 97 const CreateRouteCallback& callback)); | 97 const CreateRouteCallback& callback)); |
| 98 MOCK_METHOD5(JoinRoute, | 98 MOCK_METHOD5(JoinRoute, |
| 99 void(const mojo::String& source_urn, | 99 void(const mojo::String& source_urn, |
| 100 const mojo::String& presentation_id, | 100 const mojo::String& presentation_id, |
| 101 const mojo::String& origin, | 101 const mojo::String& origin, |
| 102 int tab_id, | 102 int tab_id, |
| 103 const JoinRouteCallback& callback)); | 103 const JoinRouteCallback& callback)); |
| 104 MOCK_METHOD6(ConnectRouteByRouteId, |
| 105 void(const mojo::String& source_urn, |
| 106 const mojo::String& route_id, |
| 107 const mojo::String& presentation_id, |
| 108 const mojo::String& origin, |
| 109 int tab_id, |
| 110 const JoinRouteCallback& callback)); |
| 104 MOCK_METHOD1(DetachRoute, void(const mojo::String& route_id)); | 111 MOCK_METHOD1(DetachRoute, void(const mojo::String& route_id)); |
| 105 MOCK_METHOD1(TerminateRoute, void(const mojo::String& route_id)); | 112 MOCK_METHOD1(TerminateRoute, void(const mojo::String& route_id)); |
| 106 MOCK_METHOD1(StartObservingMediaSinks, void(const mojo::String& source)); | 113 MOCK_METHOD1(StartObservingMediaSinks, void(const mojo::String& source)); |
| 107 MOCK_METHOD1(StopObservingMediaSinks, void(const mojo::String& source)); | 114 MOCK_METHOD1(StopObservingMediaSinks, void(const mojo::String& source)); |
| 108 MOCK_METHOD3(SendRouteMessage, | 115 MOCK_METHOD3(SendRouteMessage, |
| 109 void(const mojo::String& media_route_id, | 116 void(const mojo::String& media_route_id, |
| 110 const mojo::String& message, | 117 const mojo::String& message, |
| 111 const SendRouteMessageCallback& callback)); | 118 const SendRouteMessageCallback& callback)); |
| 112 void SendRouteBinaryMessage( | 119 void SendRouteBinaryMessage( |
| 113 const mojo::String& media_route_id, | 120 const mojo::String& media_route_id, |
| 114 mojo::Array<uint8_t> data, | 121 mojo::Array<uint8_t> data, |
| 115 const SendRouteMessageCallback& callback) override { | 122 const SendRouteMessageCallback& callback) override { |
| 116 SendRouteBinaryMessageInternal(media_route_id, data.storage(), callback); | 123 SendRouteBinaryMessageInternal(media_route_id, data.storage(), callback); |
| 117 } | 124 } |
| 118 MOCK_METHOD3(SendRouteBinaryMessageInternal, | 125 MOCK_METHOD3(SendRouteBinaryMessageInternal, |
| 119 void(const mojo::String& media_route_id, | 126 void(const mojo::String& media_route_id, |
| 120 const std::vector<uint8_t>& data, | 127 const std::vector<uint8_t>& data, |
| 121 const SendRouteMessageCallback& callback)); | 128 const SendRouteMessageCallback& callback)); |
| 122 MOCK_METHOD2(ListenForRouteMessages, | 129 MOCK_METHOD2(ListenForRouteMessages, |
| 123 void(const mojo::String& route_id, | 130 void(const mojo::String& route_id, |
| 124 const ListenForRouteMessagesCallback& callback)); | 131 const ListenForRouteMessagesCallback& callback)); |
| 125 MOCK_METHOD1(StopListeningForRouteMessages, | 132 MOCK_METHOD1(StopListeningForRouteMessages, |
| 126 void(const mojo::String& route_id)); | 133 void(const mojo::String& route_id)); |
| 127 MOCK_METHOD1(OnPresentationSessionDetached, | 134 MOCK_METHOD1(OnPresentationSessionDetached, |
| 128 void(const mojo::String& route_id)); | 135 void(const mojo::String& route_id)); |
| 129 MOCK_METHOD0(StartObservingMediaRoutes, void()); | 136 MOCK_METHOD1(StartObservingMediaRoutes, void(const mojo::String& source)); |
| 130 MOCK_METHOD0(StopObservingMediaRoutes, void()); | 137 MOCK_METHOD1(StopObservingMediaRoutes, void(const mojo::String& source)); |
| 131 | 138 |
| 132 private: | 139 private: |
| 133 DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider); | 140 DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider); |
| 134 }; | 141 }; |
| 135 | 142 |
| 136 class MockMediaSinksObserver : public MediaSinksObserver { | 143 class MockMediaSinksObserver : public MediaSinksObserver { |
| 137 public: | 144 public: |
| 138 MockMediaSinksObserver(MediaRouter* router, const MediaSource& source); | 145 MockMediaSinksObserver(MediaRouter* router, const MediaSource& source); |
| 139 ~MockMediaSinksObserver() override; | 146 ~MockMediaSinksObserver() override; |
| 140 | 147 |
| 141 MOCK_METHOD1(OnSinksReceived, void(const std::vector<MediaSink>& sinks)); | 148 MOCK_METHOD1(OnSinksReceived, void(const std::vector<MediaSink>& sinks)); |
| 142 }; | 149 }; |
| 143 | 150 |
| 144 class MockMediaRoutesObserver : public MediaRoutesObserver { | 151 class MockMediaRoutesObserver : public MediaRoutesObserver { |
| 145 public: | 152 public: |
| 146 explicit MockMediaRoutesObserver(MediaRouter* router); | 153 explicit MockMediaRoutesObserver(MediaRouter* router, |
| 154 const MediaSource::Id source_id = std::string()); |
| 147 ~MockMediaRoutesObserver() override; | 155 ~MockMediaRoutesObserver() override; |
| 148 | 156 |
| 149 MOCK_METHOD1(OnRoutesUpdated, void(const std::vector<MediaRoute>& sinks)); | 157 MOCK_METHOD2(OnRoutesUpdated, void(const std::vector<MediaRoute>& routes, |
| 158 const std::vector<MediaRoute::Id>& joinable_route_ids)); |
| 150 }; | 159 }; |
| 151 | 160 |
| 152 class MockEventPageTracker : public extensions::EventPageTracker { | 161 class MockEventPageTracker : public extensions::EventPageTracker { |
| 153 public: | 162 public: |
| 154 MockEventPageTracker(); | 163 MockEventPageTracker(); |
| 155 ~MockEventPageTracker(); | 164 ~MockEventPageTracker(); |
| 156 | 165 |
| 157 MOCK_METHOD1(IsEventPageSuspended, bool(const std::string& extension_id)); | 166 MOCK_METHOD1(IsEventPageSuspended, bool(const std::string& extension_id)); |
| 158 MOCK_METHOD2(WakeEventPage, | 167 MOCK_METHOD2(WakeEventPage, |
| 159 bool(const std::string& extension_id, | 168 bool(const std::string& extension_id, |
| 160 const base::Callback<void(bool)>& callback)); | 169 const base::Callback<void(bool)>& callback)); |
| 161 }; | 170 }; |
| 162 | 171 |
| 163 class MockPresentationConnectionStateChangedCallback { | 172 class MockPresentationConnectionStateChangedCallback { |
| 164 public: | 173 public: |
| 165 MockPresentationConnectionStateChangedCallback(); | 174 MockPresentationConnectionStateChangedCallback(); |
| 166 ~MockPresentationConnectionStateChangedCallback(); | 175 ~MockPresentationConnectionStateChangedCallback(); |
| 167 MOCK_METHOD1(Run, void(content::PresentationConnectionState)); | 176 MOCK_METHOD1(Run, void(content::PresentationConnectionState)); |
| 168 }; | 177 }; |
| 169 | 178 |
| 170 } // namespace media_router | 179 } // namespace media_router |
| 171 | 180 |
| 172 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ | 181 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ |
| OLD | NEW |