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

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

Issue 2714783002: [Presentation API] (browser side) Implement reconnect() for 1-UA mode (Closed)
Patch Set: resolve code review comments from Mark Created 3 years, 9 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/offscreen_presentation_manager_unittest.cc
diff --git a/chrome/browser/media/router/offscreen_presentation_manager_unittest.cc b/chrome/browser/media/router/offscreen_presentation_manager_unittest.cc
index 4563517006cd4a9903ff0b360b0b288ba1f57b83..2902756d4b094100b96ab59e5559ab2d8c45ed43 100644
--- a/chrome/browser/media/router/offscreen_presentation_manager_unittest.cc
+++ b/chrome/browser/media/router/offscreen_presentation_manager_unittest.cc
@@ -39,7 +39,15 @@ class MockReceiverConnectionAvailableCallback {
class OffscreenPresentationManagerTest : public ::testing::Test {
public:
OffscreenPresentationManagerTest()
- : render_frame_host_id_(1, 1), presentation_url_(kPresentationUrl) {}
+ : render_frame_host_id_(1, 1),
+ presentation_url_(kPresentationUrl),
+ route_("route_1",
+ MediaSource("source_1"),
+ "sink_1",
+ "",
+ false,
+ "",
+ false) {}
OffscreenPresentationManager* manager() { return &manager_; }
@@ -60,7 +68,7 @@ class OffscreenPresentationManagerTest : public ::testing::Test {
content::PresentationConnectionRequest receiver_conn_request;
manager()->RegisterOffscreenPresentationController(
presentation_id, presentation_url_, render_frame_host_id_,
- std::move(controller), std::move(receiver_conn_request));
+ std::move(controller), std::move(receiver_conn_request), route_);
}
void RegisterController(const RenderFrameHostId& render_frame_id,
@@ -68,14 +76,14 @@ class OffscreenPresentationManagerTest : public ::testing::Test {
content::PresentationConnectionRequest receiver_conn_request;
manager()->RegisterOffscreenPresentationController(
kPresentationId, presentation_url_, render_frame_id,
- std::move(controller), std::move(receiver_conn_request));
+ std::move(controller), std::move(receiver_conn_request), route_);
}
void RegisterController(content::PresentationConnectionPtr controller) {
content::PresentationConnectionRequest receiver_conn_request;
manager()->RegisterOffscreenPresentationController(
kPresentationId, presentation_url_, render_frame_host_id_,
- std::move(controller), std::move(receiver_conn_request));
+ std::move(controller), std::move(receiver_conn_request), route_);
}
void RegisterReceiver(
@@ -111,6 +119,7 @@ class OffscreenPresentationManagerTest : public ::testing::Test {
const RenderFrameHostId render_frame_host_id_;
GURL presentation_url_;
OffscreenPresentationManager manager_;
+ MediaRoute route_;
};
TEST_F(OffscreenPresentationManagerTest, RegisterUnregisterController) {
@@ -298,4 +307,24 @@ TEST_F(OffscreenPresentationManagerTest, TwoPresentations) {
VerifyPresentationsSize(1);
}
+TEST_F(OffscreenPresentationManagerTest, TestIsOffscreenPresentation) {
+ EXPECT_FALSE(manager()->IsOffscreenPresentation(kPresentationId));
+ content::PresentationConnectionPtr controller1;
+ RegisterController(kPresentationId, std::move(controller1));
+ EXPECT_TRUE(manager()->IsOffscreenPresentation(kPresentationId));
+}
+
+TEST_F(OffscreenPresentationManagerTest, TestRegisterAndGetRoute) {
+ MediaSource source("source_1");
+ MediaRoute route("route_1", source, "sink_1", "", false, "", false);
+
+ EXPECT_FALSE(manager()->GetRoute(kPresentationId));
+ content::PresentationConnectionPtr controller;
+ RegisterController(std::move(controller));
+
+ auto* actual_route = manager()->GetRoute(kPresentationId);
+ EXPECT_TRUE(actual_route);
+ EXPECT_TRUE(route.Equals(*actual_route));
+}
+
} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698