| 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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "chrome/browser/media/router/mock_media_router.h" | 12 #include "chrome/browser/media/router/mock_media_router.h" |
| 13 #include "chrome/browser/media/router/mojo/media_router.mojom.h" | 13 #include "chrome/browser/media/router/mojo/media_router.mojom.h" |
| 14 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h" | 14 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h" |
| 15 #include "chrome/browser/media/router/test_helper.h" | 15 #include "chrome/browser/media/router/test_helper.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "content/public/test/test_browser_thread_bundle.h" | 17 #include "content/public/test/test_browser_thread_bundle.h" |
| 18 #include "extensions/browser/event_page_tracker.h" | 18 #include "extensions/browser/event_page_tracker.h" |
| 19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
| 20 #include "mojo/public/cpp/bindings/binding.h" | 20 #include "mojo/public/cpp/bindings/binding.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 namespace media_router { | 24 namespace media_router { |
| 25 | 25 |
| 26 class MediaRouterMojoImpl; | 26 class MediaRouterMojoImpl; |
| 27 | 27 |
| 28 class MockMediaRouteProvider : public interfaces::MediaRouteProvider { | 28 class MockMediaRouteProvider : public mojom::MediaRouteProvider { |
| 29 public: | 29 public: |
| 30 MockMediaRouteProvider(); | 30 MockMediaRouteProvider(); |
| 31 ~MockMediaRouteProvider() override; | 31 ~MockMediaRouteProvider() override; |
| 32 | 32 |
| 33 MOCK_METHOD8(CreateRoute, | 33 MOCK_METHOD8(CreateRoute, |
| 34 void(const std::string& source_urn, | 34 void(const std::string& source_urn, |
| 35 const std::string& sink_id, | 35 const std::string& sink_id, |
| 36 const std::string& presentation_id, | 36 const std::string& presentation_id, |
| 37 const std::string& origin, | 37 const std::string& origin, |
| 38 int tab_id, | 38 int tab_id, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 void(const std::string& route_id)); | 81 void(const std::string& route_id)); |
| 82 MOCK_METHOD1(OnPresentationSessionDetached, | 82 MOCK_METHOD1(OnPresentationSessionDetached, |
| 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 interfaces::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 SearchSinks_(sink_id, media_source, search_criteria, callback); |
| 94 } | 94 } |
| 95 MOCK_METHOD4(SearchSinks_, | 95 MOCK_METHOD4(SearchSinks_, |
| 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 interfaces::SinkSearchCriteriaPtr& search_criteria, | 98 mojom::SinkSearchCriteriaPtr& search_criteria, |
| 99 const SearchSinksCallback& callback)); | 99 const SearchSinksCallback& callback)); |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider); | 102 DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 class MockEventPageTracker : public extensions::EventPageTracker { | 105 class MockEventPageTracker : public extensions::EventPageTracker { |
| 106 public: | 106 public: |
| 107 MockEventPageTracker(); | 107 MockEventPageTracker(); |
| 108 ~MockEventPageTracker(); | 108 ~MockEventPageTracker(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 130 | 130 |
| 131 const std::string& extension_id() const { return extension_->id(); } | 131 const std::string& extension_id() const { return extension_->id(); } |
| 132 | 132 |
| 133 MediaRouterMojoImpl* router() const { return mock_media_router_.get(); } | 133 MediaRouterMojoImpl* router() const { return mock_media_router_.get(); } |
| 134 | 134 |
| 135 // Mock objects. | 135 // Mock objects. |
| 136 MockMediaRouteProvider mock_media_route_provider_; | 136 MockMediaRouteProvider mock_media_route_provider_; |
| 137 testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; | 137 testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; |
| 138 | 138 |
| 139 // Mojo proxy object for |mock_media_router_| | 139 // Mojo proxy object for |mock_media_router_| |
| 140 media_router::interfaces::MediaRouterPtr media_router_proxy_; | 140 media_router::mojom::MediaRouterPtr media_router_proxy_; |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 content::TestBrowserThreadBundle test_thread_bundle_; | 143 content::TestBrowserThreadBundle test_thread_bundle_; |
| 144 scoped_refptr<extensions::Extension> extension_; | 144 scoped_refptr<extensions::Extension> extension_; |
| 145 std::unique_ptr<MediaRouterMojoImpl> mock_media_router_; | 145 std::unique_ptr<MediaRouterMojoImpl> mock_media_router_; |
| 146 std::unique_ptr<mojo::Binding<interfaces::MediaRouteProvider>> binding_; | 146 std::unique_ptr<mojo::Binding<mojom::MediaRouteProvider>> binding_; |
| 147 | 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); | 148 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace media_router | 151 } // namespace media_router |
| 152 | 152 |
| 153 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ | 153 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_TEST_H_ |
| OLD | NEW |