Chromium Code Reviews| Index: chrome/browser/media/router/mojo/media_router_mojo_test.h |
| diff --git a/chrome/browser/media/router/mojo/media_router_mojo_test.h b/chrome/browser/media/router/mojo/media_router_mojo_test.h |
| index 4149d41bb8d26e7ae8fcd4ab4af851a69cf55620..472bae9fffdadc50b75229a612a588b8a8c3ee5b 100644 |
| --- a/chrome/browser/media/router/mojo/media_router_mojo_test.h |
| +++ b/chrome/browser/media/router/mojo/media_router_mojo_test.h |
| @@ -9,6 +9,7 @@ |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/test/mock_callback.h" |
| #include "chrome/browser/media/router/mock_media_router.h" |
| #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h" |
| #include "chrome/browser/media/router/test_helper.h" |
| @@ -157,6 +158,22 @@ class MockMediaRouteControllerObserver : public MediaRouteController::Observer { |
| MOCK_METHOD0(OnControllerInvalidated, void()); |
| }; |
| +// Mockable class for awaiting RegisterMediaRouteProvider callbacks. |
| +class RegisterMediaRouteProviderHandler { |
| + public: |
| + RegisterMediaRouteProviderHandler(); |
| + ~RegisterMediaRouteProviderHandler(); |
| + |
| + void Invoke(const std::string& instance_id, |
| + mojom::MediaRouteProviderConfigPtr config) { |
|
Kevin M
2017/05/03 21:07:28
This is to deal with move-only |config|, right? Ma
zhaobin
2017/05/04 23:52:36
Done.
|
| + InvokeRaw(instance_id, config.get()); |
| + } |
| + |
| + MOCK_METHOD2(InvokeRaw, |
| + void(const std::string& instance_id, |
| + mojom::MediaRouteProviderConfig* config)); |
| +}; |
| + |
| // Tests the API call flow between the MediaRouterMojoImpl and the Media Router |
| // Mojo service in both directions. |
| class MediaRouterMojoTest : public ::testing::Test { |
| @@ -183,9 +200,12 @@ class MediaRouterMojoTest : public ::testing::Test { |
| // Mojo proxy object for |mock_media_router_| |
| media_router::mojom::MediaRouterPtr media_router_proxy_; |
| + RegisterMediaRouteProviderHandler provide_handler_; |
| + |
| private: |
| content::TestBrowserThreadBundle test_thread_bundle_; |
| scoped_refptr<extensions::Extension> extension_; |
| + std::unique_ptr<TestingProfile> profile_; |
|
Kevin M
2017/05/03 21:07:28
Why is this a unique_ptr?
zhaobin
2017/05/04 23:52:36
Done.
|
| std::unique_ptr<MediaRouterMojoImpl> mock_media_router_; |
|
Kevin M
2017/05/03 21:07:28
Ditto here
zhaobin
2017/05/04 23:52:36
It was uniqe_ptr before. Leave it as it it...
|
| std::unique_ptr<mojo::Binding<mojom::MediaRouteProvider>> binding_; |