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

Side by Side Diff: chrome/browser/media/router/test_helper.h

Issue 2410553002: Show Media Router toolbar icon ephemerally for MR dialogs (Closed)
Patch Set: Deleted the first patch set on accident, responded to Mark's comments inline below Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "chrome/browser/media/router/issues_observer.h" 15 #include "chrome/browser/media/router/issues_observer.h"
16 #include "chrome/browser/media/router/media_router_ui_service.h"
16 #include "chrome/browser/media/router/media_routes_observer.h" 17 #include "chrome/browser/media/router/media_routes_observer.h"
17 #include "chrome/browser/media/router/media_sinks_observer.h" 18 #include "chrome/browser/media/router/media_sinks_observer.h"
19 #include "chrome/browser/ui/toolbar/media_router_action_controller.h"
18 #include "content/public/browser/presentation_service_delegate.h" 20 #include "content/public/browser/presentation_service_delegate.h"
19 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
20 22
21 namespace media_router { 23 namespace media_router {
22 24
23 // Matcher for objects that uses Equals() member function for equality check. 25 // Matcher for objects that uses Equals() member function for equality check.
24 MATCHER_P(Equals, other, "") { 26 MATCHER_P(Equals, other, "") {
25 return arg.Equals(other); 27 return arg.Equals(other);
26 } 28 }
27 29
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 77
76 MATCHER_P(IssueTitleEquals, title, "") { 78 MATCHER_P(IssueTitleEquals, title, "") {
77 return arg.title() == title; 79 return arg.title() == title;
78 } 80 }
79 81
80 MATCHER_P(StateChageInfoEquals, other, "") { 82 MATCHER_P(StateChageInfoEquals, other, "") {
81 return arg.state == other.state && arg.close_reason == other.close_reason && 83 return arg.state == other.state && arg.close_reason == other.close_reason &&
82 arg.message == other.message; 84 arg.message == other.message;
83 } 85 }
84 86
87 void MockPresentationSessionSuccessCallback(
88 const content::PresentationSessionInfo&,
89 const MediaRoute::Id&);
90 void MockPresentationSessionErrorCallback(const content::PresentationError&);
91
85 class MockIssuesObserver : public IssuesObserver { 92 class MockIssuesObserver : public IssuesObserver {
86 public: 93 public:
87 explicit MockIssuesObserver(MediaRouter* router); 94 explicit MockIssuesObserver(MediaRouter* router);
88 ~MockIssuesObserver() override; 95 ~MockIssuesObserver() override;
89 96
90 MOCK_METHOD1(OnIssueUpdated, void(const Issue* issue)); 97 MOCK_METHOD1(OnIssueUpdated, void(const Issue* issue));
91 }; 98 };
92 99
93 class MockMediaSinksObserver : public MediaSinksObserver { 100 class MockMediaSinksObserver : public MediaSinksObserver {
94 public: 101 public:
(...skipping 16 matching lines...) Expand all
111 }; 118 };
112 119
113 class MockPresentationConnectionStateChangedCallback { 120 class MockPresentationConnectionStateChangedCallback {
114 public: 121 public:
115 MockPresentationConnectionStateChangedCallback(); 122 MockPresentationConnectionStateChangedCallback();
116 ~MockPresentationConnectionStateChangedCallback(); 123 ~MockPresentationConnectionStateChangedCallback();
117 MOCK_METHOD1(Run, 124 MOCK_METHOD1(Run,
118 void(const content::PresentationConnectionStateChangeInfo&)); 125 void(const content::PresentationConnectionStateChangeInfo&));
119 }; 126 };
120 127
128 class MockMediaRouterActionController : public MediaRouterActionController {
mark a. foltz 2016/10/17 18:57:39 It feels odd that this ended up in c/b/media/route
takumif 2016/10/27 23:06:38 Moved to media_router_web_ui_test.h, where it's us
129 public:
130 explicit MockMediaRouterActionController(Profile* profile);
131 ~MockMediaRouterActionController() override;
132
133 MOCK_METHOD1(OnIssueUpdated, void(const media_router::Issue* issue));
134 MOCK_METHOD2(OnRoutesUpdated,
135 void(const std::vector<media_router::MediaRoute>& routes,
136 const std::vector<media_router::MediaRoute::Id>&
137 joinable_route_ids));
138 MOCK_METHOD0(OnDialogShown, void());
139 MOCK_METHOD0(OnDialogHidden, void());
140 MOCK_METHOD0(MaybeAddOrRemoveAction, void());
141 };
142
143 class MockMediaRouterUIService : public MediaRouterUIService {
144 public:
145 explicit MockMediaRouterUIService(Profile* profile);
146 ~MockMediaRouterUIService() override;
147
148 MediaRouterActionController* action_controller() const override;
149
150 private:
151 std::unique_ptr<MediaRouterActionController> action_controller_;
152 };
153
121 } // namespace media_router 154 } // namespace media_router
122 155
123 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ 156 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698