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 Media Router and the MRPM in both |
| 24 // directions. Calls are made through Mojo service bindings backed by mock |
| 25 // objects. |
| 26 // |
| 27 // Calls from the Media Router to the extension are verified with this flow: |
| 28 // api_impl_ -> mrpm_host_proxy_ -> mock_mrpm_host_ |
| 29 class MediaRouterMojoTest : public ::testing::Test { |
| 30 public: |
| 31 MediaRouterMojoTest(); |
| 32 ~MediaRouterMojoTest() override; |
| 33 |
| 34 void SetUp() override; |
| 35 |
| 36 void ProcessEventLoop(); |
| 37 |
| 38 std::string extension_id() const { return "extensionId"; } |
| 39 |
| 40 protected: |
| 41 void ConnectProviderManagerService(); |
| 42 |
| 43 std::string extension_id_; |
| 44 |
| 45 base::MessageLoop message_loop_; |
| 46 |
| 47 scoped_ptr<MediaRouterMojoImpl> observer_impl_; |
| 48 |
| 49 MockMojoMediaRouterService mock_mrpm_host_; |
| 50 testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; |
| 51 |
| 52 // Service proxy objects, to be backed by mock_* objects. |
| 53 media_router::interfaces::MediaRouterObserverPtr observer_proxy_; |
| 54 interfaces::MediaRouterPtr mrpm_host_proxy_; |
| 55 |
| 56 scoped_ptr<mojo::Binding<interfaces::MediaRouter>> binding; |
| 57 |
| 58 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); |
| 60 }; |
| 61 |
| 62 } // namespace media_router |
| 63 |
| 64 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |
OLD | NEW |