| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void(const std::string& route_id)); | 83 void(const std::string& route_id)); |
| 84 MOCK_METHOD1(StartObservingMediaRoutes, void(const std::string& source)); | 84 MOCK_METHOD1(StartObservingMediaRoutes, void(const std::string& source)); |
| 85 MOCK_METHOD1(StopObservingMediaRoutes, void(const std::string& source)); | 85 MOCK_METHOD1(StopObservingMediaRoutes, void(const std::string& source)); |
| 86 MOCK_METHOD0(EnableMdnsDiscovery, void()); | 86 MOCK_METHOD0(EnableMdnsDiscovery, void()); |
| 87 MOCK_METHOD1(UpdateMediaSinks, void(const std::string& source)); | 87 MOCK_METHOD1(UpdateMediaSinks, void(const std::string& source)); |
| 88 void SearchSinks( | 88 void SearchSinks( |
| 89 const std::string& sink_id, | 89 const std::string& sink_id, |
| 90 const std::string& media_source, | 90 const std::string& media_source, |
| 91 mojom::SinkSearchCriteriaPtr search_criteria, | 91 mojom::SinkSearchCriteriaPtr search_criteria, |
| 92 const SearchSinksCallback& callback) override { | 92 const SearchSinksCallback& callback) override { |
| 93 SearchSinks_(sink_id, media_source, search_criteria, callback); | 93 SearchSinksInternal(sink_id, media_source, search_criteria, callback); |
| 94 } | 94 } |
| 95 MOCK_METHOD4(SearchSinks_, | 95 MOCK_METHOD4(SearchSinksInternal, |
| 96 void(const std::string& sink_id, | 96 void(const std::string& sink_id, |
| 97 const std::string& media_source, | 97 const std::string& media_source, |
| 98 mojom::SinkSearchCriteriaPtr& search_criteria, | 98 mojom::SinkSearchCriteriaPtr& search_criteria, |
| 99 const SearchSinksCallback& callback)); | 99 const SearchSinksCallback& callback)); |
| 100 void CreateMediaRouteController( |
| 101 const std::string& route_id, |
| 102 mojom::MediaControllerRequest media_controller, |
| 103 const CreateMediaRouteControllerCallback& callback) override { |
| 104 CreateMediaRouteControllerInternal(route_id, media_controller, callback); |
| 105 } |
| 106 MOCK_METHOD3(CreateMediaRouteControllerInternal, |
| 107 void(const std::string& route_id, |
| 108 mojom::MediaControllerRequest& media_controller, |
| 109 const CreateMediaRouteControllerCallback& callback)); |
| 110 void SetMediaRouteStatusObserver( |
| 111 const std::string& route_id, |
| 112 mojom::MediaStatusObserverPtr observer) override { |
| 113 SetMediaRouteStatusObserverInternal(route_id, observer); |
| 114 } |
| 115 MOCK_METHOD2(SetMediaRouteStatusObserverInternal, |
| 116 void(const std::string& route_id, |
| 117 mojom::MediaStatusObserverPtr& observer)); |
| 100 | 118 |
| 101 private: | 119 private: |
| 102 DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider); | 120 DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider); |
| 103 }; | 121 }; |
| 104 | 122 |
| 105 class MockEventPageTracker : public extensions::EventPageTracker { | 123 class MockEventPageTracker : public extensions::EventPageTracker { |
| 106 public: | 124 public: |
| 107 MockEventPageTracker(); | 125 MockEventPageTracker(); |
| 108 ~MockEventPageTracker(); | 126 ~MockEventPageTracker(); |
| 109 | 127 |
| 110 MOCK_METHOD1(IsEventPageSuspended, bool(const std::string& extension_id)); | 128 MOCK_METHOD1(IsEventPageSuspended, bool(const std::string& extension_id)); |
| 111 MOCK_METHOD2(WakeEventPage, | 129 MOCK_METHOD2(WakeEventPage, |
| 112 bool(const std::string& extension_id, | 130 bool(const std::string& extension_id, |
| 113 const base::Callback<void(bool)>& callback)); | 131 const base::Callback<void(bool)>& callback)); |
| 114 }; | 132 }; |
| 115 | 133 |
| 134 class MockMediaController : public mojom::MediaController { |
| 135 public: |
| 136 MockMediaController(); |
| 137 ~MockMediaController(); |
| 138 |
| 139 void Bind(mojom::MediaControllerRequest request); |
| 140 mojom::MediaControllerPtr BindInterfacePtr(); |
| 141 void CloseBinding(); |
| 142 |
| 143 MOCK_METHOD0(Play, void()); |
| 144 MOCK_METHOD0(Pause, void()); |
| 145 MOCK_METHOD1(SetMute, void(bool mute)); |
| 146 MOCK_METHOD1(SetVolume, void(float volume)); |
| 147 MOCK_METHOD1(Seek, void(base::TimeDelta time)); |
| 148 |
| 149 private: |
| 150 mojo::Binding<mojom::MediaController> binding_; |
| 151 }; |
| 152 |
| 153 class MockMediaRouteControllerObserver : public MediaRouteController::Observer { |
| 154 public: |
| 155 MockMediaRouteControllerObserver( |
| 156 scoped_refptr<MediaRouteController> controller); |
| 157 ~MockMediaRouteControllerObserver() override; |
| 158 |
| 159 MOCK_METHOD1(OnMediaStatusUpdated, void(const MediaStatus& status)); |
| 160 MOCK_METHOD0(OnControllerInvalidated, void()); |
| 161 }; |
| 162 |
| 116 // Tests the API call flow between the MediaRouterMojoImpl and the Media Router | 163 // Tests the API call flow between the MediaRouterMojoImpl and the Media Router |
| 117 // Mojo service in both directions. | 164 // Mojo service in both directions. |
| 118 class MediaRouterMojoTest : public ::testing::Test { | 165 class MediaRouterMojoTest : public ::testing::Test { |
| 119 public: | 166 public: |
| 120 MediaRouterMojoTest(); | 167 MediaRouterMojoTest(); |
| 121 ~MediaRouterMojoTest() override; | 168 ~MediaRouterMojoTest() override; |
| 122 | 169 |
| 123 protected: | 170 protected: |
| 124 void SetUp() override; | 171 void SetUp() override; |
| 125 void TearDown() override; | 172 void TearDown() override; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 144 scoped_refptr<extensions::Extension> extension_; | 191 scoped_refptr<extensions::Extension> extension_; |
| 145 std::unique_ptr<MediaRouterMojoImpl> mock_media_router_; | 192 std::unique_ptr<MediaRouterMojoImpl> mock_media_router_; |
| 146 std::unique_ptr<mojo::Binding<mojom::MediaRouteProvider>> binding_; | 193 std::unique_ptr<mojo::Binding<mojom::MediaRouteProvider>> binding_; |
| 147 | 194 |
| 148 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); | 195 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); |
| 149 }; | 196 }; |
| 150 | 197 |
| 151 } // namespace media_router | 198 } // namespace media_router |
| 152 | 199 |
| 153 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ | 200 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ |
| OLD | NEW |