Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: chrome/browser/media/router/media_router_mojo_test.cc

Issue 1055403006: Upstreaming review for Media Router Mojo interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate latest changes to MR API. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/media_router_mojo_test.cc
diff --git a/chrome/browser/media/router/media_router_mojo_test.cc b/chrome/browser/media/router/media_router_mojo_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..691c29dc3f302210f8dff8ea7b5549ae860f57ba
--- /dev/null
+++ b/chrome/browser/media/router/media_router_mojo_test.cc
@@ -0,0 +1,76 @@
+// 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.
+
+#include "chrome/browser/media/router/media_router_mojo_test.h"
+
+#include "base/run_loop.h"
+
+namespace media_router {
+namespace {
+
+const char kInstanceId[] = "instance123";
+
+template <typename T1, typename T2>
+void ExpectAsyncResultEqual(T1 expected, T2 actual) {
+ EXPECT_EQ(expected, actual);
+}
+
+} // namespace
+
+MockMojoMediaRouterService::MockMojoMediaRouterService() {
+}
+
+MockMojoMediaRouterService::~MockMojoMediaRouterService() {
+}
+
+MockApiDelegate::MockApiDelegate() {
+}
+
+MockApiDelegate::~MockApiDelegate() {
+}
+
+MediaRouterMojoTest::MediaRouterMojoTest()
+ : message_loop_(mojo::common::MessagePumpMojo::Create()),
+ observer_impl_(nullptr) {
+}
+
+MediaRouterMojoTest::~MediaRouterMojoTest() {
+}
+
+void MediaRouterMojoTest::ConnectProviderManagerService() {
+ interfaces::MediaRouterPtr mrpm_host_proxy;
+
+ observer_impl_->instance_id_ = kInstanceId;
+
+ // Bind the API impl under test to service_proxy.
+ auto request = mojo::GetProxy(&observer_proxy_);
+ observer_impl_->Bind(request.Pass());
+ // Bind the mock delegate to a proxy.
+ binding.reset(new mojo::Binding<interfaces::MediaRouter>(
+ &mock_mrpm_host_, mojo::GetProxy(&mrpm_host_proxy)));
+ observer_proxy_->ProvideMediaRouter(
+ mrpm_host_proxy.Pass(),
+ base::Bind(&ExpectAsyncResultEqual<std::string, mojo::String>,
+ kInstanceId));
+}
+
+void MediaRouterMojoTest::SetUp() {
+ extension_id_ = "ext-123";
+
+ observer_impl_.reset(
+ new MediaRouterMojoImpl(extension_id_, &mock_event_page_tracker_));
+
+ ON_CALL(mock_event_page_tracker_, IsEventPageSuspended(extension_id_))
+ .WillByDefault(testing::Return(false));
+
+ ConnectProviderManagerService();
+
+ message_loop_.RunUntilIdle();
+}
+
+void MediaRouterMojoTest::ProcessEventLoop() {
+ base::RunLoop().RunUntilIdle();
+}
+
+} // namespace media_router
« no previous file with comments | « chrome/browser/media/router/media_router_mojo_test.h ('k') | chrome/browser/media/router/media_router_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698