| 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_MEDIA_ROUTER_MOJO_TEST_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_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/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "chrome/browser/media/router/media_router_mojo_impl.h" | 13 #include "chrome/browser/media/router/media_router_mojo_impl.h" |
| 13 #include "chrome/browser/media/router/mock_media_router.h" | 14 #include "chrome/browser/media/router/mock_media_router.h" |
| 14 #include "chrome/browser/media/router/test_helper.h" | 15 #include "chrome/browser/media/router/test_helper.h" |
| 15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "extensions/common/extension.h" |
| 16 #include "mojo/public/cpp/bindings/binding.h" | 18 #include "mojo/public/cpp/bindings/binding.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 21 |
| 20 namespace media_router { | 22 namespace media_router { |
| 21 | 23 |
| 22 class MediaRouterMojoImpl; | 24 class MediaRouterMojoImpl; |
| 23 class MessagePump; | 25 class MessagePump; |
| 24 | 26 |
| 25 // Tests the API call flow between the MediaRouterMojoImpl and the Media Router | 27 // Tests the API call flow between the MediaRouterMojoImpl and the Media Router |
| 26 // Mojo service in both directions. | 28 // Mojo service in both directions. |
| 27 class MediaRouterMojoTest : public ::testing::Test { | 29 class MediaRouterMojoTest : public ::testing::Test { |
| 28 public: | 30 public: |
| 29 MediaRouterMojoTest(); | 31 MediaRouterMojoTest(); |
| 30 ~MediaRouterMojoTest() override; | 32 ~MediaRouterMojoTest() override; |
| 31 | 33 |
| 32 protected: | 34 protected: |
| 33 void SetUp() override; | 35 void SetUp() override; |
| 34 | 36 |
| 35 void ProcessEventLoop(); | 37 void ProcessEventLoop(); |
| 36 | 38 |
| 37 void ConnectProviderManagerService(); | 39 void ConnectProviderManagerService(); |
| 38 | 40 |
| 39 const std::string& extension_id() const { return extension_id_; } | 41 const std::string& extension_id() const { return extension_->id(); } |
| 40 | 42 |
| 41 MediaRouterMojoImpl* router() const { return mock_media_router_.get(); } | 43 MediaRouterMojoImpl* router() const { return mock_media_router_.get(); } |
| 42 | 44 |
| 43 // Mock objects. | 45 // Mock objects. |
| 44 MockMediaRouteProvider mock_media_route_provider_; | 46 MockMediaRouteProvider mock_media_route_provider_; |
| 45 testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; | 47 testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; |
| 46 | 48 |
| 47 // Mojo proxy object for |mock_media_router_| | 49 // Mojo proxy object for |mock_media_router_| |
| 48 media_router::interfaces::MediaRouterPtr media_router_proxy_; | 50 media_router::interfaces::MediaRouterPtr media_router_proxy_; |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 std::string extension_id_; | 53 scoped_refptr<extensions::Extension> extension_; |
| 52 scoped_ptr<MediaRouterMojoImpl> mock_media_router_; | 54 scoped_ptr<MediaRouterMojoImpl> mock_media_router_; |
| 53 scoped_ptr<mojo::Binding<interfaces::MediaRouteProvider>> binding_; | 55 scoped_ptr<mojo::Binding<interfaces::MediaRouteProvider>> binding_; |
| 54 base::MessageLoop message_loop_; | 56 base::MessageLoop message_loop_; |
| 55 | 57 |
| 56 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); | 58 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace media_router | 61 } // namespace media_router |
| 60 | 62 |
| 61 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ | 63 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |
| OLD | NEW |