Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: chrome/browser/media/router/mojo/media_router_mojo_test.h

Issue 2873893003: [Media Router] Add features to control browser side discovery (Closed)
Patch Set: restore original name and add comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 class MockMediaRouteControllerObserver : public MediaRouteController::Observer { 167 class MockMediaRouteControllerObserver : public MediaRouteController::Observer {
168 public: 168 public:
169 MockMediaRouteControllerObserver( 169 MockMediaRouteControllerObserver(
170 scoped_refptr<MediaRouteController> controller); 170 scoped_refptr<MediaRouteController> controller);
171 ~MockMediaRouteControllerObserver() override; 171 ~MockMediaRouteControllerObserver() override;
172 172
173 MOCK_METHOD1(OnMediaStatusUpdated, void(const MediaStatus& status)); 173 MOCK_METHOD1(OnMediaStatusUpdated, void(const MediaStatus& status));
174 MOCK_METHOD0(OnControllerInvalidated, void()); 174 MOCK_METHOD0(OnControllerInvalidated, void());
175 }; 175 };
176 176
177 // Mockable class for awaiting RegisterMediaRouteProvider callbacks.
178 class RegisterMediaRouteProviderHandler {
179 public:
180 RegisterMediaRouteProviderHandler();
181 ~RegisterMediaRouteProviderHandler();
182
183 // A wrapper function to deal with move only parameter |config|.
184 void Invoke(const std::string& instance_id,
185 mojom::MediaRouteProviderConfigPtr config) {
186 InvokeRaw(instance_id, config.get());
187 }
188
189 MOCK_METHOD2(InvokeRaw,
mark a. foltz 2017/05/11 23:17:59 In general we have been using InvokeInternal for t
zhaobin 2017/05/12 00:16:51 Done.
190 void(const std::string& instance_id,
191 mojom::MediaRouteProviderConfig* config));
192 };
193
177 // Tests the API call flow between the MediaRouterMojoImpl and the Media Router 194 // Tests the API call flow between the MediaRouterMojoImpl and the Media Router
178 // Mojo service in both directions. 195 // Mojo service in both directions.
179 class MediaRouterMojoTest : public ::testing::Test { 196 class MediaRouterMojoTest : public ::testing::Test {
180 public: 197 public:
181 MediaRouterMojoTest(); 198 MediaRouterMojoTest();
182 ~MediaRouterMojoTest() override; 199 ~MediaRouterMojoTest() override;
183 200
184 protected: 201 protected:
185 void SetUp() override; 202 void SetUp() override;
186 void TearDown() override; 203 void TearDown() override;
187 204
188 void ProcessEventLoop(); 205 void ProcessEventLoop();
189 206
190 void ConnectProviderManagerService(); 207 void ConnectProviderManagerService();
191 208
192 const std::string& extension_id() const { return extension_->id(); } 209 const std::string& extension_id() const { return extension_->id(); }
193 210
194 MediaRouterMojoImpl* router() const { return mock_media_router_.get(); } 211 MediaRouterMojoImpl* router() const { return mock_media_router_.get(); }
195 212
196 // Mock objects. 213 // Mock objects.
197 MockMediaRouteProvider mock_media_route_provider_; 214 MockMediaRouteProvider mock_media_route_provider_;
198 testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; 215 testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_;
199 216
200 // Mojo proxy object for |mock_media_router_| 217 // Mojo proxy object for |mock_media_router_|
201 media_router::mojom::MediaRouterPtr media_router_proxy_; 218 media_router::mojom::MediaRouterPtr media_router_proxy_;
202 219
220 RegisterMediaRouteProviderHandler provide_handler_;
221
203 private: 222 private:
204 content::TestBrowserThreadBundle test_thread_bundle_; 223 content::TestBrowserThreadBundle test_thread_bundle_;
205 scoped_refptr<extensions::Extension> extension_; 224 scoped_refptr<extensions::Extension> extension_;
206 std::unique_ptr<MediaRouterMojoImpl> mock_media_router_; 225 std::unique_ptr<MediaRouterMojoImpl> mock_media_router_;
207 std::unique_ptr<mojo::Binding<mojom::MediaRouteProvider>> binding_; 226 std::unique_ptr<mojo::Binding<mojom::MediaRouteProvider>> binding_;
208 227
209 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); 228 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest);
210 }; 229 };
211 230
212 } // namespace media_router 231 } // namespace media_router
213 232
214 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ 233 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698