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

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

Issue 1055403006: Upstreaming review for Media Router Mojo interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate latest changes to MR API. Created 5 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "chrome/browser/media/router/media_router.mojom.h"
12 #include "chrome/browser/media/router/media_router_mojo_impl.h"
13 #include "chrome/browser/media/router/media_routes_observer.h"
14 #include "chrome/browser/media/router/media_sinks_observer.h"
15 #include "extensions/browser/event_page_tracker.h"
16 #include "testing/gmock/include/gmock/gmock.h"
17
18 namespace media_router {
19
20 // Custom GMock matchers
21
22 // Checks if the two objects are the same, using the objects'
23 // .Equals() operator.
24 MATCHER_P(Equals, other, "") {
25 return arg.Equals(other);
26 }
27
28 // Checks that the elements of two sequence collections are Equal()
29 // to each other. Collections must be of equal size.
30 MATCHER_P(SequenceEquals, other, "") {
31 if (arg.size() != other.size()) {
32 return false;
33 }
34 for (size_t i = 0; i < arg.size(); ++i) {
35 if (!arg[i].Equals(other[i])) {
36 return false;
37 }
38 }
39 return true;
40 }
41
42 class MockMojoMediaRouterService : public interfaces::MediaRouter {
43 public:
44 MockMojoMediaRouterService();
45 ~MockMojoMediaRouterService() override;
46
47 MOCK_METHOD3(CreateRoute,
48 void(const mojo::String& source,
49 const mojo::String& sink_id,
50 const CreateRouteCallback& callback));
51 MOCK_METHOD1(CloseRoute, void(const mojo::String& route_id));
52 MOCK_METHOD1(StartObservingMediaSinks, void(const mojo::String& source));
53 MOCK_METHOD1(StopObservingMediaSinks, void(const mojo::String& source));
54 MOCK_METHOD2(PostMessage,
55 void(const mojo::String& media_route_id,
56 const mojo::String& message));
57 MOCK_METHOD1(ClearIssue, void(const mojo::String& issue_id));
58 MOCK_METHOD0(StartObservingMediaRoutes, void());
59 MOCK_METHOD0(StopObservingMediaRoutes, void());
60
61 private:
62 DISALLOW_COPY_AND_ASSIGN(MockMojoMediaRouterService);
63 };
64
65 class MockApiDelegate : public MediaRouterMojoImpl::Delegate {
66 public:
67 MockApiDelegate();
68 ~MockApiDelegate();
69
70 MOCK_METHOD0(OnProviderManagerReady, void(void));
71 MOCK_METHOD0(OnConnectionError, void(void));
72 MOCK_CONST_METHOD0(GetInstanceId, const std::string&(void));
73 MOCK_METHOD2(OnMessage,
74 void(const MediaRouteId& route_id, const std::string& message));
75 MOCK_METHOD1(OnIssue, void(const Issue& issue));
76
77 private:
78 DISALLOW_COPY_AND_ASSIGN(MockApiDelegate);
79 };
80
81 class MockMediaSinksObserver : public MediaSinksObserver {
82 public:
83 MockMediaSinksObserver(MediaRouter* router, const MediaSource& source);
84 ~MockMediaSinksObserver() override;
85
86 MOCK_METHOD1(OnSinksReceived, void(const std::vector<MediaSink>& sinks));
87 };
88
89 class MockMediaRoutesObserver : public MediaRoutesObserver {
90 public:
91 explicit MockMediaRoutesObserver(MediaRouter* router);
92 ~MockMediaRoutesObserver();
93
94 MOCK_METHOD1(OnRoutesUpdated, void(const std::vector<MediaRoute>& sinks));
95 };
96
97 class MockEventPageTracker : public extensions::EventPageTracker {
98 public:
99 MockEventPageTracker();
100 ~MockEventPageTracker();
101
102 MOCK_METHOD1(IsEventPageSuspended, bool(const std::string& extension_id));
103 MOCK_METHOD2(WakeEventPage,
104 bool(const std::string& extension_id,
105 const base::Callback<void(bool)>& callback));
106 };
107
108 } // namespace media_router
109
110 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/router/mock_media_router.cc ('k') | chrome/browser/media/router/test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698