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