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

Unified Diff: chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc

Issue 2666873006: [Media Router] Convert to use typemaps for media_router.mojom. (Closed)
Patch Set: Addressed Mark's comments Created 3 years, 10 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/mojo/media_router_mojo_impl_unittest.cc
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
index 70df1a64efa7b541408d70df3a06784c8b6f12c2..b40071605f8b8e934314b8e7ecc7a5d9bccd00da 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/media/router/mock_media_router.h"
#include "chrome/browser/media/router/mojo/media_router_mojo_metrics.h"
#include "chrome/browser/media/router/mojo/media_router_mojo_test.h"
-#include "chrome/browser/media/router/mojo/media_router_type_converters.h"
#include "chrome/browser/media/router/route_message.h"
#include "chrome/browser/media/router/route_message_observer.h"
#include "chrome/browser/media/router/test_helper.h"
@@ -59,11 +58,6 @@ using testing::SaveArg;
namespace media_router {
-using PresentationConnectionState =
- mojom::MediaRouter::PresentationConnectionState;
-using PresentationConnectionCloseReason =
- mojom::MediaRouter::PresentationConnectionCloseReason;
-
namespace {
const char kDescription[] = "description";
@@ -93,16 +87,9 @@ IssueInfo CreateIssueInfo(const std::string& title) {
return issue_info;
}
-mojom::MediaRoutePtr CreateMojoRoute() {
- mojom::MediaRoutePtr route = mojom::MediaRoute::New();
- route->media_source = std::string(kSource);
- route->media_sink_id = kSinkId;
- route->media_route_id = kRouteId;
- route->description = kDescription;
- route->is_local = true;
- route->for_display = true;
- route->is_incognito = false;
- return route;
+MediaRoute CreateMediaRoute() {
+ return MediaRoute(kRouteId, MediaSource(kSource), kSinkId, kDescription, true,
+ std::string(), true);
}
} // namespace
@@ -202,8 +189,7 @@ TEST_F(MediaRouterMojoImplTest, CreateRoute) {
const std::string& presentation_id, const url::Origin& origin,
int tab_id, base::TimeDelta timeout, bool incognito,
const mojom::MediaRouteProvider::CreateRouteCallback& cb) {
- cb.Run(CreateMojoRoute(), std::string(),
- mojom::RouteRequestResultCode::OK);
+ cb.Run(CreateMediaRoute(), std::string(), RouteRequestResult::OK);
}));
base::RunLoop run_loop;
@@ -219,7 +205,7 @@ TEST_F(MediaRouterMojoImplTest, CreateRoute) {
base::TimeDelta::FromMilliseconds(kTimeoutMillis),
false);
run_loop.Run();
- ExpectResultBucketCount("CreateRoute", RouteRequestResult::ResultCode::OK, 1);
+ ExpectResultBucketCount("CreateRoute", RouteRequestResult::OK, 1);
}
TEST_F(MediaRouterMojoImplTest, CreateIncognitoRoute) {
@@ -234,18 +220,13 @@ TEST_F(MediaRouterMojoImplTest, CreateIncognitoRoute) {
EXPECT_CALL(mock_media_route_provider_,
CreateRoute(kSource, kSinkId, _, url::Origin(GURL(kOrigin)),
kInvalidTabId, _, _, _))
- .WillOnce(Invoke(
- [](const std::string& source, const std::string& sink,
- const std::string& presentation_id, const url::Origin& origin,
- int tab_id, base::TimeDelta timeout, bool incognito,
- const mojom::MediaRouteProvider::CreateRouteCallback& cb) {
- mojom::MediaRoutePtr route = CreateMojoRoute();
- route->custom_controller_path =
- std::string("custom/controller/path");
- route->is_incognito = true;
- cb.Run(std::move(route), std::string(),
- mojom::RouteRequestResultCode::OK);
- }));
+ .WillOnce(Invoke([&expected_route](
+ const std::string& source, const std::string& sink,
+ const std::string& presentation_id, const url::Origin& origin,
+ int tab_id, base::TimeDelta timeout, bool incognito,
+ const mojom::MediaRouteProvider::CreateRouteCallback& cb) {
+ cb.Run(expected_route, std::string(), RouteRequestResult::OK);
+ }));
base::RunLoop run_loop;
RouteResponseCallbackHandler handler;
@@ -260,7 +241,7 @@ TEST_F(MediaRouterMojoImplTest, CreateIncognitoRoute) {
base::TimeDelta::FromMilliseconds(kTimeoutMillis),
true);
run_loop.Run();
- ExpectResultBucketCount("CreateRoute", RouteRequestResult::ResultCode::OK, 1);
+ ExpectResultBucketCount("CreateRoute", RouteRequestResult::OK, 1);
}
TEST_F(MediaRouterMojoImplTest, CreateRouteFails) {
@@ -274,8 +255,8 @@ TEST_F(MediaRouterMojoImplTest, CreateRouteFails) {
const std::string& presentation_id, const url::Origin& origin,
int tab_id, base::TimeDelta timeout, bool incognito,
const mojom::MediaRouteProvider::CreateRouteCallback& cb) {
- cb.Run(mojom::MediaRoutePtr(), std::string(kError),
- mojom::RouteRequestResultCode::TIMED_OUT);
+ cb.Run(base::nullopt, std::string(kError),
+ RouteRequestResult::TIMED_OUT);
}));
RouteResponseCallbackHandler handler;
@@ -291,8 +272,7 @@ TEST_F(MediaRouterMojoImplTest, CreateRouteFails) {
base::TimeDelta::FromMilliseconds(kTimeoutMillis),
false);
run_loop.Run();
- ExpectResultBucketCount("CreateRoute",
- RouteRequestResult::ResultCode::TIMED_OUT, 1);
+ ExpectResultBucketCount("CreateRoute", RouteRequestResult::TIMED_OUT, 1);
}
TEST_F(MediaRouterMojoImplTest, CreateRouteIncognitoMismatchFails) {
@@ -306,8 +286,7 @@ TEST_F(MediaRouterMojoImplTest, CreateRouteIncognitoMismatchFails) {
const std::string& presentation_id, const url::Origin& origin,
int tab_id, base::TimeDelta timeout, bool incognito,
const mojom::MediaRouteProvider::CreateRouteCallback& cb) {
mark a. foltz 2017/02/09 22:53:52 Can this callback be typemapped? Same comment app
- cb.Run(CreateMojoRoute(), std::string(),
- mojom::RouteRequestResultCode::OK);
+ cb.Run(CreateMediaRoute(), std::string(), RouteRequestResult::OK);
}));
RouteResponseCallbackHandler handler;
@@ -324,49 +303,45 @@ TEST_F(MediaRouterMojoImplTest, CreateRouteIncognitoMismatchFails) {
base::TimeDelta::FromMilliseconds(kTimeoutMillis),
true);
run_loop.Run();
- ExpectResultBucketCount(
- "CreateRoute", RouteRequestResult::ResultCode::INCOGNITO_MISMATCH, 1);
+ ExpectResultBucketCount("CreateRoute", RouteRequestResult::INCOGNITO_MISMATCH,
+ 1);
}
TEST_F(MediaRouterMojoImplTest, IncognitoRoutesTerminatedOnProfileShutdown) {
- mojom::MediaRoutePtr route = CreateMojoRoute();
- route->is_incognito = true;
+ MediaRoute route = CreateMediaRoute();
+ route.set_incognito(true);
EXPECT_CALL(
mock_media_route_provider_,
CreateRoute(kSource, kSinkId, _, url::Origin(GURL(kOrigin)),
kInvalidTabId,
base::TimeDelta::FromMilliseconds(kTimeoutMillis), true, _))
- .WillOnce(Invoke(
- [](const std::string& source, const std::string& sink,
- const std::string& presentation_id, const url::Origin& origin,
- int tab_id, base::TimeDelta timeout, bool incognito,
- const mojom::MediaRouteProvider::CreateRouteCallback& cb) {
- mojom::MediaRoutePtr route = CreateMojoRoute();
- route->is_incognito = true;
- cb.Run(std::move(route), std::string(),
- mojom::RouteRequestResultCode::OK);
- }));
+ .WillOnce(Invoke([&route](
+ const std::string& source, const std::string& sink,
+ const std::string& presentation_id, const url::Origin& origin,
+ int tab_id, base::TimeDelta timeout, bool incognito,
+ const mojom::MediaRouteProvider::CreateRouteCallback& cb) {
+ cb.Run(route, std::string(), RouteRequestResult::OK);
+ }));
base::RunLoop run_loop;
router()->CreateRoute(kSource, kSinkId, url::Origin(GURL(kOrigin)), nullptr,
std::vector<MediaRouteResponseCallback>(),
base::TimeDelta::FromMilliseconds(kTimeoutMillis),
true);
- std::vector<mojom::MediaRoutePtr> mojo_routes(1);
- mojo_routes[0] = route->Clone();
- router()->OnRoutesUpdated(std::move(mojo_routes), std::string(),
- std::vector<std::string>());
+ std::vector<MediaRoute> routes;
mark a. foltz 2017/02/09 22:53:52 routes({route}). Or just create the vector in the
+ routes.push_back(route);
+ router()->OnRoutesUpdated(routes, std::string(), std::vector<std::string>());
// TODO(mfoltz): Where possible, convert other tests to use RunUntilIdle
// instead of manually calling Run/Quit on the run loop.
run_loop.RunUntilIdle();
EXPECT_CALL(mock_media_route_provider_, TerminateRoute(kRouteId, _))
- .WillOnce(Invoke([](
- const std::string& route_id,
- const mojom::MediaRouteProvider::TerminateRouteCallback& cb) {
- cb.Run(base::nullopt, mojom::RouteRequestResultCode::OK);
- }));
+ .WillOnce(Invoke(
+ [](const std::string& route_id,
+ const mojom::MediaRouteProvider::TerminateRouteCallback& cb) {
+ cb.Run(base::nullopt, RouteRequestResult::OK);
+ }));
base::RunLoop run_loop2;
router()->OnIncognitoProfileShutdown();
@@ -378,13 +353,12 @@ TEST_F(MediaRouterMojoImplTest, JoinRoute) {
MediaRoute expected_route(kRouteId, media_source, kSinkId, "", false, "",
false);
- mojom::MediaRoutePtr route = CreateMojoRoute();
+ MediaRoute route = CreateMediaRoute();
// Make sure the MR has received an update with the route, so it knows there
// is a route to join.
- std::vector<mojom::MediaRoutePtr> mojo_routes(1);
- mojo_routes[0] = route->Clone();
- router()->OnRoutesUpdated(std::move(mojo_routes), std::string(),
- std::vector<std::string>());
+ std::vector<MediaRoute> routes;
+ routes.push_back(route);
+ router()->OnRoutesUpdated(routes, std::string(), std::vector<std::string>());
EXPECT_TRUE(router()->HasJoinableRoute());
// Use a lambda function as an invocation target here to work around
@@ -400,8 +374,7 @@ TEST_F(MediaRouterMojoImplTest, JoinRoute) {
const url::Origin& origin, int tab_id, base::TimeDelta timeout,
bool incognito,
const mojom::MediaRouteProvider::JoinRouteCallback& cb) {
- cb.Run(std::move(route), std::string(),
- mojom::RouteRequestResultCode::OK);
+ cb.Run(route, std::string(), RouteRequestResult::OK);
}));
RouteResponseCallbackHandler handler;
@@ -416,7 +389,7 @@ TEST_F(MediaRouterMojoImplTest, JoinRoute) {
nullptr, route_response_callbacks,
base::TimeDelta::FromMilliseconds(kTimeoutMillis), false);
run_loop.Run();
- ExpectResultBucketCount("JoinRoute", RouteRequestResult::ResultCode::OK, 1);
+ ExpectResultBucketCount("JoinRoute", RouteRequestResult::OK, 1);
}
TEST_F(MediaRouterMojoImplTest, JoinRouteNotFoundFails) {
@@ -432,17 +405,15 @@ TEST_F(MediaRouterMojoImplTest, JoinRouteNotFoundFails) {
nullptr, route_response_callbacks,
base::TimeDelta::FromMilliseconds(kTimeoutMillis), false);
run_loop.Run();
- ExpectResultBucketCount("JoinRoute",
- RouteRequestResult::ResultCode::ROUTE_NOT_FOUND, 1);
+ ExpectResultBucketCount("JoinRoute", RouteRequestResult::ROUTE_NOT_FOUND, 1);
}
TEST_F(MediaRouterMojoImplTest, JoinRouteTimedOutFails) {
// Make sure the MR has received an update with the route, so it knows there
// is a route to join.
- std::vector<mojom::MediaRoutePtr> mojo_routes(1);
- mojo_routes[0] = CreateMojoRoute();
- router()->OnRoutesUpdated(std::move(mojo_routes), std::string(),
- std::vector<std::string>());
+ std::vector<MediaRoute> routes;
+ routes.push_back(CreateMediaRoute());
+ router()->OnRoutesUpdated(routes, std::string(), std::vector<std::string>());
EXPECT_TRUE(router()->HasJoinableRoute());
EXPECT_CALL(
@@ -455,8 +426,8 @@ TEST_F(MediaRouterMojoImplTest, JoinRouteTimedOutFails) {
const url::Origin& origin, int tab_id, base::TimeDelta timeout,
bool incognito,
const mojom::MediaRouteProvider::JoinRouteCallback& cb) {
- cb.Run(mojom::MediaRoutePtr(), std::string(kError),
- mojom::RouteRequestResultCode::TIMED_OUT);
+ cb.Run(base::nullopt, std::string(kError),
+ RouteRequestResult::TIMED_OUT);
}));
RouteResponseCallbackHandler handler;
@@ -471,19 +442,17 @@ TEST_F(MediaRouterMojoImplTest, JoinRouteTimedOutFails) {
nullptr, route_response_callbacks,
base::TimeDelta::FromMilliseconds(kTimeoutMillis), false);
run_loop.Run();
- ExpectResultBucketCount("JoinRoute",
- RouteRequestResult::ResultCode::TIMED_OUT, 1);
+ ExpectResultBucketCount("JoinRoute", RouteRequestResult::TIMED_OUT, 1);
}
TEST_F(MediaRouterMojoImplTest, JoinRouteIncognitoMismatchFails) {
- mojom::MediaRoutePtr route = CreateMojoRoute();
+ MediaRoute route = CreateMediaRoute();
// Make sure the MR has received an update with the route, so it knows there
// is a route to join.
- std::vector<mojom::MediaRoutePtr> mojo_routes(1);
- mojo_routes[0] = route->Clone();
- router()->OnRoutesUpdated(std::move(mojo_routes), std::string(),
- std::vector<std::string>());
+ std::vector<MediaRoute> routes;
+ routes.push_back(route);
+ router()->OnRoutesUpdated(routes, std::string(), std::vector<std::string>());
EXPECT_TRUE(router()->HasJoinableRoute());
// Use a lambda function as an invocation target here to work around
@@ -499,8 +468,7 @@ TEST_F(MediaRouterMojoImplTest, JoinRouteIncognitoMismatchFails) {
const url::Origin& origin, int tab_id, base::TimeDelta timeout,
bool incognito,
const mojom::MediaRouteProvider::JoinRouteCallback& cb) {
- cb.Run(std::move(route), std::string(),
- mojom::RouteRequestResultCode::OK);
+ cb.Run(route, std::string(), RouteRequestResult::OK);
}));
RouteResponseCallbackHandler handler;
@@ -516,8 +484,8 @@ TEST_F(MediaRouterMojoImplTest, JoinRouteIncognitoMismatchFails) {
nullptr, route_response_callbacks,
base::TimeDelta::FromMilliseconds(kTimeoutMillis), true);
run_loop.Run();
- ExpectResultBucketCount(
- "JoinRoute", RouteRequestResult::ResultCode::INCOGNITO_MISMATCH, 1);
+ ExpectResultBucketCount("JoinRoute", RouteRequestResult::INCOGNITO_MISMATCH,
+ 1);
}
TEST_F(MediaRouterMojoImplTest, ConnectRouteByRouteId) {
@@ -525,7 +493,7 @@ TEST_F(MediaRouterMojoImplTest, ConnectRouteByRouteId) {
MediaRoute expected_route(kRouteId, media_source, kSinkId, "", false, "",
false);
expected_route.set_incognito(false);
- mojom::MediaRoutePtr route = CreateMojoRoute();
+ MediaRoute route = CreateMediaRoute();
// Use a lambda function as an invocation target here to work around
// a limitation with GMock::Invoke that prevents it from using move-only types
@@ -540,8 +508,7 @@ TEST_F(MediaRouterMojoImplTest, ConnectRouteByRouteId) {
const std::string& presentation_id, const url::Origin& origin,
int tab_id, base::TimeDelta timeout, bool incognito,
const mojom::MediaRouteProvider::JoinRouteCallback& cb) {
- cb.Run(std::move(route), std::string(),
- mojom::RouteRequestResultCode::OK);
+ cb.Run(route, std::string(), RouteRequestResult::OK);
}));
RouteResponseCallbackHandler handler;
@@ -557,7 +524,7 @@ TEST_F(MediaRouterMojoImplTest, ConnectRouteByRouteId) {
route_response_callbacks,
base::TimeDelta::FromMilliseconds(kTimeoutMillis), false);
run_loop.Run();
- ExpectResultBucketCount("JoinRoute", RouteRequestResult::ResultCode::OK, 1);
+ ExpectResultBucketCount("JoinRoute", RouteRequestResult::OK, 1);
}
TEST_F(MediaRouterMojoImplTest, ConnectRouteByRouteIdFails) {
@@ -571,8 +538,8 @@ TEST_F(MediaRouterMojoImplTest, ConnectRouteByRouteIdFails) {
const std::string& presentation_id, const url::Origin& origin,
int tab_id, base::TimeDelta timeout, bool incognito,
const mojom::MediaRouteProvider::JoinRouteCallback& cb) {
- cb.Run(mojom::MediaRoutePtr(), std::string(kError),
- mojom::RouteRequestResultCode::TIMED_OUT);
+ cb.Run(base::nullopt, std::string(kError),
+ RouteRequestResult::TIMED_OUT);
}));
RouteResponseCallbackHandler handler;
@@ -588,12 +555,11 @@ TEST_F(MediaRouterMojoImplTest, ConnectRouteByRouteIdFails) {
route_response_callbacks,
base::TimeDelta::FromMilliseconds(kTimeoutMillis), true);
run_loop.Run();
- ExpectResultBucketCount("JoinRoute",
- RouteRequestResult::ResultCode::TIMED_OUT, 1);
+ ExpectResultBucketCount("JoinRoute", RouteRequestResult::TIMED_OUT, 1);
}
TEST_F(MediaRouterMojoImplTest, ConnectRouteByIdIncognitoMismatchFails) {
- mojom::MediaRoutePtr route = CreateMojoRoute();
+ MediaRoute route = CreateMediaRoute();
// Use a lambda function as an invocation target here to work around
// a limitation with GMock::Invoke that prevents it from using move-only types
@@ -608,8 +574,7 @@ TEST_F(MediaRouterMojoImplTest, ConnectRouteByIdIncognitoMismatchFails) {
const std::string& presentation_id, const url::Origin& origin,
int tab_id, base::TimeDelta timeout, bool incognito,
const mojom::MediaRouteProvider::JoinRouteCallback& cb) {
- cb.Run(std::move(route), std::string(),
- mojom::RouteRequestResultCode::OK);
+ cb.Run(route, std::string(), RouteRequestResult::OK);
}));
RouteResponseCallbackHandler handler;
@@ -626,8 +591,8 @@ TEST_F(MediaRouterMojoImplTest, ConnectRouteByIdIncognitoMismatchFails) {
route_response_callbacks,
base::TimeDelta::FromMilliseconds(kTimeoutMillis), true);
run_loop.Run();
- ExpectResultBucketCount(
- "JoinRoute", RouteRequestResult::ResultCode::INCOGNITO_MISMATCH, 1);
+ ExpectResultBucketCount("JoinRoute", RouteRequestResult::INCOGNITO_MISMATCH,
+ 1);
}
TEST_F(MediaRouterMojoImplTest, DetachRoute) {
@@ -641,35 +606,28 @@ TEST_F(MediaRouterMojoImplTest, DetachRoute) {
TEST_F(MediaRouterMojoImplTest, TerminateRoute) {
base::RunLoop run_loop;
EXPECT_CALL(mock_media_route_provider_, TerminateRoute(kRouteId, _))
- .WillOnce(Invoke([](
- const std::string& route_id,
- const mojom::MediaRouteProvider::TerminateRouteCallback& cb) {
- cb.Run(base::nullopt, mojom::RouteRequestResultCode::OK);
- }));
+ .WillOnce(Invoke(
+ [](const std::string& route_id,
+ const mojom::MediaRouteProvider::TerminateRouteCallback& cb) {
+ cb.Run(base::nullopt, RouteRequestResult::OK);
+ }));
router()->TerminateRoute(kRouteId);
run_loop.RunUntilIdle();
- ExpectResultBucketCount("TerminateRoute",
- RouteRequestResult::ResultCode::OK,
- 1);
+ ExpectResultBucketCount("TerminateRoute", RouteRequestResult::OK, 1);
}
TEST_F(MediaRouterMojoImplTest, TerminateRouteFails) {
base::RunLoop run_loop;
EXPECT_CALL(mock_media_route_provider_, TerminateRoute(kRouteId, _))
- .WillOnce(Invoke([](
- const std::string& route_id,
- const mojom::MediaRouteProvider::TerminateRouteCallback& cb) {
- cb.Run(std::string("timed out"),
- mojom::RouteRequestResultCode::TIMED_OUT);
- }));
+ .WillOnce(Invoke(
+ [](const std::string& route_id,
+ const mojom::MediaRouteProvider::TerminateRouteCallback& cb) {
+ cb.Run(std::string("timed out"), RouteRequestResult::TIMED_OUT);
+ }));
router()->TerminateRoute(kRouteId);
run_loop.RunUntilIdle();
- ExpectResultBucketCount("TerminateRoute",
- RouteRequestResult::ResultCode::OK,
- 0);
- ExpectResultBucketCount("TerminateRoute",
- RouteRequestResult::ResultCode::TIMED_OUT,
- 1);
+ ExpectResultBucketCount("TerminateRoute", RouteRequestResult::OK, 0);
+ ExpectResultBucketCount("TerminateRoute", RouteRequestResult::TIMED_OUT, 1);
}
TEST_F(MediaRouterMojoImplTest, HandleIssue) {
@@ -737,25 +695,13 @@ TEST_F(MediaRouterMojoImplTest, RegisterAndUnregisterMediaSinksObserver) {
expected_sinks.push_back(
MediaSink(kSinkId2, kSinkName, MediaSink::IconType::CAST));
- std::vector<mojom::MediaSinkPtr> mojo_sinks(2);
- mojo_sinks[0] = mojom::MediaSink::New();
- mojo_sinks[0]->sink_id = kSinkId;
- mojo_sinks[0]->name = kSinkName;
- mojo_sinks[0]->icon_type =
- media_router::mojom::MediaSink::IconType::CAST;
- mojo_sinks[1] = mojom::MediaSink::New();
- mojo_sinks[1]->sink_id = kSinkId2;
- mojo_sinks[1]->name = kSinkName;
- mojo_sinks[1]->icon_type =
- media_router::mojom::MediaSink::IconType::CAST;
-
base::RunLoop run_loop;
EXPECT_CALL(*sinks_observer, OnSinksReceived(SequenceEquals(expected_sinks)));
EXPECT_CALL(*extra_sinks_observer,
OnSinksReceived(SequenceEquals(expected_sinks)))
.WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
media_router_proxy_->OnSinksReceived(
- media_source.id(), std::move(mojo_sinks),
+ media_source.id(), expected_sinks,
std::vector<url::Origin>(1, url::Origin(GURL(kOrigin))));
run_loop.Run();
@@ -892,16 +838,6 @@ TEST_F(MediaRouterMojoImplTest, RegisterAndUnregisterMediaRoutesObserver) {
expected_joinable_route_ids.push_back(kJoinableRouteId);
expected_joinable_route_ids.push_back(kJoinableRouteId2);
- std::vector<std::string> mojo_joinable_routes(2);
- mojo_joinable_routes[0] = kJoinableRouteId;
- mojo_joinable_routes[1] = kJoinableRouteId2;
-
- std::vector<mojom::MediaRoutePtr> mojo_routes(2);
- mojo_routes[0] = CreateMojoRoute();
- mojo_routes[1] = CreateMojoRoute();
- mojo_routes[1]->media_route_id = kRouteId2;
- mojo_routes[1]->is_incognito = true;
-
EXPECT_CALL(routes_observer, OnRoutesUpdated(SequenceEquals(expected_routes),
expected_joinable_route_ids));
EXPECT_CALL(extra_routes_observer,
@@ -911,9 +847,8 @@ TEST_F(MediaRouterMojoImplTest, RegisterAndUnregisterMediaRoutesObserver) {
OnRoutesUpdated(SequenceEquals(expected_routes),
expected_joinable_route_ids))
.Times(0);
- media_router_proxy_->OnRoutesUpdated(std::move(mojo_routes),
- media_source.id(),
- std::move(mojo_joinable_routes));
+ media_router_proxy_->OnRoutesUpdated(expected_routes, media_source.id(),
+ expected_joinable_route_ids);
ProcessEventLoop();
EXPECT_CALL(mock_router, UnregisterMediaRoutesObserver(&routes_observer));
@@ -1118,7 +1053,8 @@ TEST_F(MediaRouterMojoImplTest, PresentationConnectionStateChangedCallback) {
EXPECT_CALL(callback, Run(StateChangeInfoEquals(closed_info)))
.WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
media_router_proxy_->OnPresentationConnectionClosed(
- route_id, PresentationConnectionCloseReason::WENT_AWAY, "Foo");
+ route_id, content::PRESENTATION_CONNECTION_CLOSE_REASON_WENT_AWAY,
+ "Foo");
run_loop.Run();
EXPECT_TRUE(Mock::VerifyAndClearExpectations(&callback));
}
@@ -1130,7 +1066,7 @@ TEST_F(MediaRouterMojoImplTest, PresentationConnectionStateChangedCallback) {
EXPECT_CALL(callback, Run(StateChangeInfoEquals(terminated_info)))
.WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
media_router_proxy_->OnPresentationConnectionStateChanged(
- route_id, PresentationConnectionState::TERMINATED);
+ route_id, content::PRESENTATION_CONNECTION_STATE_TERMINATED);
run_loop.Run();
EXPECT_TRUE(Mock::VerifyAndClearExpectations(&callback));
@@ -1153,7 +1089,7 @@ TEST_F(MediaRouterMojoImplTest,
EXPECT_CALL(callback, Run(_)).Times(0);
media_router_proxy_->OnPresentationConnectionStateChanged(
- route_id, PresentationConnectionState::TERMINATED);
+ route_id, content::PRESENTATION_CONNECTION_STATE_TERMINATED);
ProcessEventLoop();
}

Powered by Google App Engine
This is Rietveld 408576698