OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/message_loop/message_loop.h" |
| 11 #include "chrome/browser/media/router/media_router_mojo_impl.h" |
| 12 #include "chrome/browser/media/router/mock_media_router.h" |
| 13 #include "chrome/browser/media/router/test_helper.h" |
| 14 #include "chrome/test/base/testing_profile.h" |
| 15 #include "mojo/common/message_pump_mojo.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 |
| 19 namespace media_router { |
| 20 |
| 21 class MediaRouterMojoImpl; |
| 22 |
| 23 // Tests the API call flow between the MediaRouterMojoImpl and the Media Router |
| 24 // Mojo service in both directions. |
| 25 // Calls are made through Mojo service bindings backed by mock objects. |
| 26 // |router_| delegates Media Router calls to |mock_mojo_media_router_service_|, |
| 27 // which represents the service provided by the component extension. |
| 28 // Calls from the component extension back to |router_| via the |
| 29 // MediaRouterObserver interface can be simulated with |
| 30 // |mojo_media_router_observer_|. |
| 31 class MediaRouterMojoTest : public ::testing::Test { |
| 32 public: |
| 33 MediaRouterMojoTest(); |
| 34 ~MediaRouterMojoTest() override; |
| 35 |
| 36 protected: |
| 37 void SetUp() override; |
| 38 |
| 39 void ProcessEventLoop(); |
| 40 |
| 41 void ConnectProviderManagerService(); |
| 42 |
| 43 const std::string& extension_id() const { return extension_id_; } |
| 44 |
| 45 MediaRouterMojoImpl* router() const { return router_.get(); } |
| 46 |
| 47 // Mock objects. |
| 48 MockMojoMediaRouterService mock_mojo_media_router_service_; |
| 49 testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; |
| 50 |
| 51 // MediaRouterObserver interface that is bound to |router_|. |
| 52 media_router::interfaces::MediaRouterObserverPtr mojo_media_router_observer_; |
| 53 |
| 54 private: |
| 55 base::MessageLoop message_loop_; |
| 56 std::string extension_id_; |
| 57 scoped_ptr<MediaRouterMojoImpl> router_; |
| 58 scoped_ptr<mojo::Binding<interfaces::MediaRouter>> binding_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); |
| 61 }; |
| 62 |
| 63 } // namespace media_router |
| 64 |
| 65 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |
OLD | NEW |