Chromium Code Reviews| Index: chrome/browser/media/router/media_router_mojo_test.h |
| diff --git a/chrome/browser/media/router/media_router_mojo_test.h b/chrome/browser/media/router/media_router_mojo_test.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f0261bf1eb4b2c0cc8598f693629849df4df1b5b |
| --- /dev/null |
| +++ b/chrome/browser/media/router/media_router_mojo_test.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |
| +#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/message_loop/message_loop.h" |
| +#include "chrome/browser/media/router/media_router_mojo_impl.h" |
| +#include "chrome/browser/media/router/mock_media_router.h" |
| +#include "chrome/browser/media/router/test_helper.h" |
| +#include "chrome/test/base/testing_profile.h" |
| +#include "mojo/common/message_pump_mojo.h" |
| +#include "testing/gmock/include/gmock/gmock.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace media_router { |
| + |
| +class MediaRouterMojoImpl; |
| + |
| +// Tests the API call flow between the Media Router and the MRPM in both |
| +// directions. Calls are made through Mojo service bindings backed by mock |
| +// objects. |
| +// |
| +// Calls from the Media Router to the extension are verified with this flow: |
| +// 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.
|
| +class MediaRouterMojoTest : public ::testing::Test { |
| + public: |
| + MediaRouterMojoTest(); |
| + ~MediaRouterMojoTest() override; |
| + |
| + void SetUp() override; |
| + |
| + void ProcessEventLoop(); |
| + |
| + std::string extension_id() const { return "extensionId"; } |
| + |
| + protected: |
| + void ConnectProviderManagerService(); |
| + |
| + std::string extension_id_; |
| + |
| + base::MessageLoop message_loop_; |
| + |
| + scoped_ptr<MediaRouterMojoImpl> observer_impl_; |
| + |
| + // Mock objects. |
| + MockMojoMediaRouterService mock_mrpm_host_; |
|
xhwang
2015/05/28 06:53:21
ditto
imcheng (use chromium acct)
2015/05/28 20:46:35
Done.
|
| + testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; |
| + |
| + // Mojo service proxy objects, which are backed by the mock objects above. |
| + media_router::interfaces::MediaRouterObserverPtr observer_proxy_; |
| + interfaces::MediaRouterPtr mrpm_host_proxy_; |
|
xhwang
2015/05/28 06:53:21
ditto
imcheng (use chromium acct)
2015/05/28 20:46:35
Done.
|
| + |
| + 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
|
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); |
| +}; |
| + |
| +} // namespace media_router |
| + |
| +#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |