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..310a9944e274de4d48b621736f8d60662a0a7a08 |
--- /dev/null |
+++ b/chrome/browser/media/router/media_router_mojo_test.h |
@@ -0,0 +1,64 @@ |
+// 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_ |
+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_; |
+ |
+ MockMojoMediaRouterService mock_mrpm_host_; |
+ testing::NiceMock<MockEventPageTracker> mock_event_page_tracker_; |
+ |
+ // Service proxy objects, to be backed by mock_* objects. |
+ media_router::interfaces::MediaRouterObserverPtr observer_proxy_; |
+ interfaces::MediaRouterPtr mrpm_host_proxy_; |
+ |
+ scoped_ptr<mojo::Binding<interfaces::MediaRouter>> binding; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoTest); |
+}; |
+ |
+} // namespace media_router |
+ |
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_TEST_H_ |