| 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 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "chrome/browser/media/router/create_presentation_connection_request.h" | 8 #include "chrome/browser/media/router/create_presentation_connection_request.h" |
| 9 #include "chrome/browser/media/router/media_router_dialog_controller.h" | 9 #include "chrome/browser/media/router/media_router_dialog_controller.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/features.h" | |
| 12 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 11 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 13 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
| 14 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 17 |
| 19 using ::testing::Return; | 18 using ::testing::Return; |
| 20 | 19 |
| 21 namespace media_router { | 20 namespace media_router { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 base::Bind(&MediaRouterDialogControllerTest::RequestSuccess, | 74 base::Bind(&MediaRouterDialogControllerTest::RequestSuccess, |
| 76 base::Unretained(this)), | 75 base::Unretained(this)), |
| 77 base::Bind(&MediaRouterDialogControllerTest::RequestError, | 76 base::Bind(&MediaRouterDialogControllerTest::RequestError, |
| 78 base::Unretained(this)))); | 77 base::Unretained(this)))); |
| 79 } | 78 } |
| 80 | 79 |
| 81 std::unique_ptr<TestMediaRouterDialogController> dialog_controller_; | 80 std::unique_ptr<TestMediaRouterDialogController> dialog_controller_; |
| 82 std::unique_ptr<MockWebContentsDelegate> web_contents_delegate_; | 81 std::unique_ptr<MockWebContentsDelegate> web_contents_delegate_; |
| 83 }; | 82 }; |
| 84 | 83 |
| 85 #if BUILDFLAG(ANDROID_JAVA_UI) | 84 #if defined(OS_ANDROID) |
| 86 // The non-Android implementation is tested in | 85 // The non-Android implementation is tested in |
| 87 // MediaRouterDialogControllerImplTest. | 86 // MediaRouterDialogControllerImplTest. |
| 88 TEST_F(MediaRouterDialogControllerTest, CreateForWebContents) { | 87 TEST_F(MediaRouterDialogControllerTest, CreateForWebContents) { |
| 89 MediaRouterDialogController* dialog_controller = | 88 MediaRouterDialogController* dialog_controller = |
| 90 MediaRouterDialogController::GetOrCreateForWebContents(web_contents()); | 89 MediaRouterDialogController::GetOrCreateForWebContents(web_contents()); |
| 91 ASSERT_NE(dialog_controller, nullptr); | 90 ASSERT_NE(dialog_controller, nullptr); |
| 92 } | 91 } |
| 93 #endif | 92 #endif |
| 94 | 93 |
| 95 TEST_F(MediaRouterDialogControllerTest, ShowAndHideDialog) { | 94 TEST_F(MediaRouterDialogControllerTest, ShowAndHideDialog) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 117 EXPECT_TRUE(dialog_controller_->IsShowingMediaRouterDialog()); | 116 EXPECT_TRUE(dialog_controller_->IsShowingMediaRouterDialog()); |
| 118 | 117 |
| 119 // If a dialog is already shown, ShowMediaRouterDialogForPresentation() should | 118 // If a dialog is already shown, ShowMediaRouterDialogForPresentation() should |
| 120 // return false. | 119 // return false. |
| 121 EXPECT_CALL(*web_contents_delegate_, ActivateContents(web_contents())); | 120 EXPECT_CALL(*web_contents_delegate_, ActivateContents(web_contents())); |
| 122 EXPECT_FALSE( | 121 EXPECT_FALSE( |
| 123 dialog_controller_->ShowMediaRouterDialogForPresentation(GetRequest())); | 122 dialog_controller_->ShowMediaRouterDialogForPresentation(GetRequest())); |
| 124 } | 123 } |
| 125 | 124 |
| 126 } // namespace media_router | 125 } // namespace media_router |
| OLD | NEW |