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