OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <memory> | 5 #include <memory> |
6 | 6 |
7 #include "chrome/browser/media/router/create_presentation_connection_request.h" | 7 #include "chrome/browser/media/router/create_presentation_connection_request.h" |
8 #include "chrome/browser/media/router/media_router_dialog_controller.h" | 8 #include "chrome/browser/media/router/media_router_dialog_controller.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 new TestMediaRouterDialogController(web_contents())); | 54 new TestMediaRouterDialogController(web_contents())); |
55 } | 55 } |
56 | 56 |
57 void TearDown() override { | 57 void TearDown() override { |
58 dialog_controller_.reset(); | 58 dialog_controller_.reset(); |
59 web_contents_delegate_.reset(); | 59 web_contents_delegate_.reset(); |
60 ChromeRenderViewHostTestHarness::TearDown(); | 60 ChromeRenderViewHostTestHarness::TearDown(); |
61 } | 61 } |
62 | 62 |
63 void RequestSuccess(const content::PresentationSessionInfo&, | 63 void RequestSuccess(const content::PresentationSessionInfo&, |
64 const MediaRoute::Id&) {} | 64 const MediaRoute&) {} |
65 void RequestError(const content::PresentationError& error) {} | 65 void RequestError(const content::PresentationError& error) {} |
66 | 66 |
67 std::unique_ptr<CreatePresentationConnectionRequest> GetRequest() { | 67 std::unique_ptr<CreatePresentationConnectionRequest> GetRequest() { |
68 return base::MakeUnique<CreatePresentationConnectionRequest>( | 68 return base::MakeUnique<CreatePresentationConnectionRequest>( |
69 RenderFrameHostId(1, 2), GURL("http://example.com"), | 69 RenderFrameHostId(1, 2), GURL("http://example.com"), |
70 GURL("http://google.com"), | 70 GURL("http://google.com"), |
71 base::Bind(&MediaRouterDialogControllerTest::RequestSuccess, | 71 base::Bind(&MediaRouterDialogControllerTest::RequestSuccess, |
72 base::Unretained(this)), | 72 base::Unretained(this)), |
73 base::Bind(&MediaRouterDialogControllerTest::RequestError, | 73 base::Bind(&MediaRouterDialogControllerTest::RequestError, |
74 base::Unretained(this))); | 74 base::Unretained(this))); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 EXPECT_TRUE(dialog_controller_->IsShowingMediaRouterDialog()); | 109 EXPECT_TRUE(dialog_controller_->IsShowingMediaRouterDialog()); |
110 | 110 |
111 // If a dialog is already shown, ShowMediaRouterDialogForPresentation() should | 111 // If a dialog is already shown, ShowMediaRouterDialogForPresentation() should |
112 // return false. | 112 // return false. |
113 EXPECT_CALL(*web_contents_delegate_, ActivateContents(web_contents())); | 113 EXPECT_CALL(*web_contents_delegate_, ActivateContents(web_contents())); |
114 EXPECT_FALSE( | 114 EXPECT_FALSE( |
115 dialog_controller_->ShowMediaRouterDialogForPresentation(GetRequest())); | 115 dialog_controller_->ShowMediaRouterDialogForPresentation(GetRequest())); |
116 } | 116 } |
117 | 117 |
118 } // namespace media_router | 118 } // namespace media_router |
OLD | NEW |