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

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: fix unittests 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>(
mark a. foltz 2016/12/02 20:59:08 I think base::MakeUnique is preferred for construc
zhaobin 2016/12/02 22:50:56 Get compile error with base::MakeUnique. It seems
70 RenderFrameHostId(1, 2), GURL("http://example.com"), 71 new CreatePresentationConnectionRequest(
71 GURL("http://google.com"), 72 RenderFrameHostId(1, 2), {GURL("http://example.com")},
mark a. foltz 2016/12/02 20:59:08 Can you pass multiple URLs here?
zhaobin 2016/12/02 22:50:56 Done.
72 base::Bind(&MediaRouterDialogControllerTest::RequestSuccess, 73 GURL("http://google.com"),
73 base::Unretained(this)), 74 base::Bind(&MediaRouterDialogControllerTest::RequestSuccess,
74 base::Bind(&MediaRouterDialogControllerTest::RequestError, 75 base::Unretained(this)),
75 base::Unretained(this))); 76 base::Bind(&MediaRouterDialogControllerTest::RequestError,
77 base::Unretained(this))));
76 } 78 }
77 79
78 std::unique_ptr<TestMediaRouterDialogController> dialog_controller_; 80 std::unique_ptr<TestMediaRouterDialogController> dialog_controller_;
79 std::unique_ptr<MockWebContentsDelegate> web_contents_delegate_; 81 std::unique_ptr<MockWebContentsDelegate> web_contents_delegate_;
80 }; 82 };
81 83
82 #if BUILDFLAG(ANDROID_JAVA_UI) 84 #if BUILDFLAG(ANDROID_JAVA_UI)
83 // The non-Android implementation is tested in 85 // The non-Android implementation is tested in
84 // MediaRouterDialogControllerImplTest. 86 // MediaRouterDialogControllerImplTest.
85 TEST_F(MediaRouterDialogControllerTest, CreateForWebContents) { 87 TEST_F(MediaRouterDialogControllerTest, CreateForWebContents) {
(...skipping 28 matching lines...) Expand all
114 EXPECT_TRUE(dialog_controller_->IsShowingMediaRouterDialog()); 116 EXPECT_TRUE(dialog_controller_->IsShowingMediaRouterDialog());
115 117
116 // If a dialog is already shown, ShowMediaRouterDialogForPresentation() should 118 // If a dialog is already shown, ShowMediaRouterDialogForPresentation() should
117 // return false. 119 // return false.
118 EXPECT_CALL(*web_contents_delegate_, ActivateContents(web_contents())); 120 EXPECT_CALL(*web_contents_delegate_, ActivateContents(web_contents()));
119 EXPECT_FALSE( 121 EXPECT_FALSE(
120 dialog_controller_->ShowMediaRouterDialogForPresentation(GetRequest())); 122 dialog_controller_->ShowMediaRouterDialogForPresentation(GetRequest()));
121 } 123 }
122 124
123 } // namespace media_router 125 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698