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

Side by Side 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 unified diff | Download patch
OLDNEW
(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 #include "chrome/browser/media/router/media_router_mojo_test.h"
6
7 #include "base/run_loop.h"
8
9 namespace media_router {
10 namespace {
11
12 const char kInstanceId[] = "instance123";
13
14 template <typename T1, typename T2>
15 void ExpectAsyncResultEqual(T1 expected, T2 actual) {
16 EXPECT_EQ(expected, actual);
17 }
18
19 } // namespace
20
21 MockMojoMediaRouterService::MockMojoMediaRouterService() {
22 }
23
24 MockMojoMediaRouterService::~MockMojoMediaRouterService() {
25 }
26
27 MockApiDelegate::MockApiDelegate() {
28 }
29
30 MockApiDelegate::~MockApiDelegate() {
31 }
32
33 MediaRouterMojoTest::MediaRouterMojoTest()
34 : message_loop_(mojo::common::MessagePumpMojo::Create()),
35 observer_impl_(nullptr) {
36 }
37
38 MediaRouterMojoTest::~MediaRouterMojoTest() {
39 }
40
41 void MediaRouterMojoTest::ConnectProviderManagerService() {
42 interfaces::MediaRouterPtr mrpm_host_proxy;
43
44 observer_impl_->instance_id_ = kInstanceId;
45
46 // Bind the API impl under test to service_proxy.
47 auto request = mojo::GetProxy(&observer_proxy_);
48 observer_impl_->Bind(request.Pass());
49 // Bind the mock delegate to a proxy.
50 binding.reset(new mojo::Binding<interfaces::MediaRouter>(
51 &mock_mrpm_host_, mojo::GetProxy(&mrpm_host_proxy)));
52 observer_proxy_->ProvideMediaRouter(
53 mrpm_host_proxy.Pass(),
54 base::Bind(&ExpectAsyncResultEqual<std::string, mojo::String>,
55 kInstanceId));
56 }
57
58 void MediaRouterMojoTest::SetUp() {
59 extension_id_ = "ext-123";
60
61 observer_impl_.reset(
62 new MediaRouterMojoImpl(extension_id_, &mock_event_page_tracker_));
63
64 ON_CALL(mock_event_page_tracker_, IsEventPageSuspended(extension_id_))
65 .WillByDefault(testing::Return(false));
66
67 ConnectProviderManagerService();
68
69 message_loop_.RunUntilIdle();
70 }
71
72 void MediaRouterMojoTest::ProcessEventLoop() {
73 base::RunLoop().RunUntilIdle();
74 }
75
76 } // namespace media_router
OLDNEW
« 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