Rename GetIconID to GetIconId
[chromium-blink-merge.git] / chrome / browser / media / router / media_router_mojo_test.cc
blob5049375e4d1dfa967d426a4ea0fa9e5acfe76aba
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.
5 #include "chrome/browser/media/router/media_router_mojo_test.h"
7 #include "base/run_loop.h"
9 namespace media_router {
10 namespace {
12 const char kInstanceId[] = "instance123";
14 template <typename T1, typename T2>
15 void ExpectAsyncResultEqual(T1 expected, T2 actual) {
16 EXPECT_EQ(expected, actual);
19 } // namespace
21 MockMediaRouteProvider::MockMediaRouteProvider() {
24 MockMediaRouteProvider::~MockMediaRouteProvider() {
27 MediaRouterMojoTest::MediaRouterMojoTest()
28 : message_loop_(mojo::common::MessagePumpMojo::Create()),
29 extension_id_("ext-123"),
30 mock_media_router_(new MediaRouterMojoImpl(&mock_event_page_tracker_)) {
31 mock_media_router_->set_instance_id_for_test(kInstanceId);
34 MediaRouterMojoTest::~MediaRouterMojoTest() {
37 void MediaRouterMojoTest::ConnectProviderManagerService() {
38 // Bind the |media_route_provider| interface to |media_route_provider_|.
39 auto request = mojo::GetProxy(&media_router_proxy_);
40 mock_media_router_->BindToMojoRequest(request.Pass(), extension_id_);
42 // Bind the Mojo MediaRouter interface used by |mock_media_router_| to
43 // |mock_media_route_provider_service_|.
44 interfaces::MediaRouteProviderPtr mojo_media_router;
45 binding_.reset(new mojo::Binding<interfaces::MediaRouteProvider>(
46 &mock_media_route_provider_, mojo::GetProxy(&mojo_media_router)));
47 media_router_proxy_->RegisterMediaRouteProvider(
48 mojo_media_router.Pass(),
49 base::Bind(&ExpectAsyncResultEqual<std::string, mojo::String>,
50 kInstanceId));
53 void MediaRouterMojoTest::SetUp() {
54 ON_CALL(mock_event_page_tracker_, IsEventPageSuspended(extension_id_))
55 .WillByDefault(testing::Return(false));
57 ConnectProviderManagerService();
59 message_loop_.RunUntilIdle();
62 void MediaRouterMojoTest::ProcessEventLoop() {
63 base::RunLoop().RunUntilIdle();
66 } // namespace media_router