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.
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_
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"
19 namespace media_router
{
21 class MediaRouterMojoImpl
;
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
{
33 MediaRouterMojoTest();
34 ~MediaRouterMojoTest() override
;
37 void SetUp() override
;
39 void ProcessEventLoop();
41 void ConnectProviderManagerService();
43 const std::string
& extension_id() const { return extension_id_
; }
45 MediaRouterMojoImpl
* router() const { return router_
.get(); }
48 MockMojoMediaRouterService mock_mojo_media_router_service_
;
49 testing::NiceMock
<MockEventPageTracker
> mock_event_page_tracker_
;
51 // MediaRouterObserver interface that is bound to |router_|.
52 media_router::interfaces::MediaRouterObserverPtr mojo_media_router_observer_
;
55 base::MessageLoop message_loop_
;
56 std::string extension_id_
;
57 scoped_ptr
<MediaRouterMojoImpl
> router_
;
58 scoped_ptr
<mojo::Binding
<interfaces::MediaRouter
>> binding_
;
60 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest
);
63 } // namespace media_router
65 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_