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_ | |
xhwang
2015/05/28 06:53:21
Do we still have the concept of mrpm? Seems like w
imcheng (use chromium acct)
2015/05/28 20:46:35
Done.
| |
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 // Mock objects. | |
50 MockMojoMediaRouterService mock_mrpm_host_; | |
xhwang
2015/05/28 06:53:21
ditto
imcheng (use chromium acct)
2015/05/28 20:46:35
Done.
| |
51 testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; | |
52 | |
53 // Mojo service proxy objects, which are backed by the mock objects above. | |
54 media_router::interfaces::MediaRouterObserverPtr observer_proxy_; | |
55 interfaces::MediaRouterPtr mrpm_host_proxy_; | |
xhwang
2015/05/28 06:53:21
ditto
imcheng (use chromium acct)
2015/05/28 20:46:35
Done.
| |
56 | |
57 scoped_ptr<mojo::Binding<interfaces::MediaRouter>> binding; | |
xhwang
2015/05/28 06:53:21
binding_
imcheng (use chromium acct)
2015/05/28 20:46:35
Done. Also cleaned this file up a bit regarding pr
| |
58 | |
59 private: | |
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 |