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

Side by Side Diff: chrome/browser/media/router/media_router_dialog_controller_unittest.cc

Issue 2547703002: [Media Router] Handle multiple Presentation URLs when creating routes (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
OLDNEW
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 7
7 #include "chrome/browser/media/router/create_presentation_connection_request.h" 8 #include "chrome/browser/media/router/create_presentation_connection_request.h"
8 #include "chrome/browser/media/router/media_router_dialog_controller.h" 9 #include "chrome/browser/media/router/media_router_dialog_controller.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/features.h" 11 #include "chrome/common/features.h"
11 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 12 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
12 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_contents_delegate.h" 15 #include "content/public/browser/web_contents_delegate.h"
15 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 dialog_controller_.reset(); 60 dialog_controller_.reset();
60 web_contents_delegate_.reset(); 61 web_contents_delegate_.reset();
61 ChromeRenderViewHostTestHarness::TearDown(); 62 ChromeRenderViewHostTestHarness::TearDown();
62 } 63 }
63 64
64 void RequestSuccess(const content::PresentationSessionInfo&, 65 void RequestSuccess(const content::PresentationSessionInfo&,
65 const MediaRoute&) {} 66 const MediaRoute&) {}
66 void RequestError(const content::PresentationError& error) {} 67 void RequestError(const content::PresentationError& error) {}
67 68
68 std::unique_ptr<CreatePresentationConnectionRequest> GetRequest() { 69 std::unique_ptr<CreatePresentationConnectionRequest> GetRequest() {
69 return base::MakeUnique<CreatePresentationConnectionRequest>( 70 return std::unique_ptr<CreatePresentationConnectionRequest>(
70 RenderFrameHostId(1, 2), GURL("http://example.com"), 71 new CreatePresentationConnectionRequest(
71 GURL("http://google.com"), 72 RenderFrameHostId(1, 2),
72 base::Bind(&MediaRouterDialogControllerTest::RequestSuccess, 73 {GURL("http://example.com"), GURL("http://example2.com")},
73 base::Unretained(this)), 74 GURL("http://google.com"),
74 base::Bind(&MediaRouterDialogControllerTest::RequestError, 75 base::Bind(&MediaRouterDialogControllerTest::RequestSuccess,
75 base::Unretained(this))); 76 base::Unretained(this)),
77 base::Bind(&MediaRouterDialogControllerTest::RequestError,
78 base::Unretained(this))));
76 } 79 }
77 80
78 std::unique_ptr<TestMediaRouterDialogController> dialog_controller_; 81 std::unique_ptr<TestMediaRouterDialogController> dialog_controller_;
79 std::unique_ptr<MockWebContentsDelegate> web_contents_delegate_; 82 std::unique_ptr<MockWebContentsDelegate> web_contents_delegate_;
80 }; 83 };
81 84
82 #if BUILDFLAG(ANDROID_JAVA_UI) 85 #if BUILDFLAG(ANDROID_JAVA_UI)
83 // The non-Android implementation is tested in 86 // The non-Android implementation is tested in
84 // MediaRouterDialogControllerImplTest. 87 // MediaRouterDialogControllerImplTest.
85 TEST_F(MediaRouterDialogControllerTest, CreateForWebContents) { 88 TEST_F(MediaRouterDialogControllerTest, CreateForWebContents) {
(...skipping 28 matching lines...) Expand all
114 EXPECT_TRUE(dialog_controller_->IsShowingMediaRouterDialog()); 117 EXPECT_TRUE(dialog_controller_->IsShowingMediaRouterDialog());
115 118
116 // If a dialog is already shown, ShowMediaRouterDialogForPresentation() should 119 // If a dialog is already shown, ShowMediaRouterDialogForPresentation() should
117 // return false. 120 // return false.
118 EXPECT_CALL(*web_contents_delegate_, ActivateContents(web_contents())); 121 EXPECT_CALL(*web_contents_delegate_, ActivateContents(web_contents()));
119 EXPECT_FALSE( 122 EXPECT_FALSE(
120 dialog_controller_->ShowMediaRouterDialogForPresentation(GetRequest())); 123 dialog_controller_->ShowMediaRouterDialogForPresentation(GetRequest()));
121 } 124 }
122 125
123 } // namespace media_router 126 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698