OLD | NEW |
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_routes_observer.h" | 16 #include "chrome/browser/media/router/media_routes_observer.h" |
17 #include "chrome/browser/media/router/media_sinks_observer.h" | 17 #include "chrome/browser/media/router/media_sinks_observer.h" |
18 #include "content/public/browser/presentation_service_delegate.h" | 18 #include "content/public/browser/presentation_service_delegate.h" |
| 19 #include "content/public/common/presentation_connection_message.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
20 | 21 |
21 namespace media_router { | 22 namespace media_router { |
22 | 23 |
23 // Matcher for objects that uses Equals() member function for equality check. | 24 // Matcher for objects that uses Equals() member function for equality check. |
24 MATCHER_P(Equals, other, "") { | 25 MATCHER_P(Equals, other, "") { |
25 return arg.Equals(other); | 26 return arg.Equals(other); |
26 } | 27 } |
27 | 28 |
28 // Matcher for a sequence of objects that uses Equals() member function for | 29 // Matcher for a sequence of objects that uses Equals() member function for |
(...skipping 13 matching lines...) Expand all Loading... |
42 // Matcher for IssueInfo title. | 43 // Matcher for IssueInfo title. |
43 MATCHER_P(IssueTitleEquals, title, "") { | 44 MATCHER_P(IssueTitleEquals, title, "") { |
44 return arg.title == title; | 45 return arg.title == title; |
45 } | 46 } |
46 | 47 |
47 MATCHER_P(StateChangeInfoEquals, other, "") { | 48 MATCHER_P(StateChangeInfoEquals, other, "") { |
48 return arg.state == other.state && arg.close_reason == other.close_reason && | 49 return arg.state == other.state && arg.close_reason == other.close_reason && |
49 arg.message == other.message; | 50 arg.message == other.message; |
50 } | 51 } |
51 | 52 |
| 53 std::string PresentationConnectionMessageToString( |
| 54 const content::PresentationConnectionMessage& message); |
| 55 |
52 class MockIssuesObserver : public IssuesObserver { | 56 class MockIssuesObserver : public IssuesObserver { |
53 public: | 57 public: |
54 explicit MockIssuesObserver(MediaRouter* router); | 58 explicit MockIssuesObserver(MediaRouter* router); |
55 ~MockIssuesObserver() override; | 59 ~MockIssuesObserver() override; |
56 | 60 |
57 MOCK_METHOD1(OnIssue, void(const Issue& issue)); | 61 MOCK_METHOD1(OnIssue, void(const Issue& issue)); |
58 MOCK_METHOD0(OnIssuesCleared, void()); | 62 MOCK_METHOD0(OnIssuesCleared, void()); |
59 }; | 63 }; |
60 | 64 |
61 class MockMediaSinksObserver : public MediaSinksObserver { | 65 class MockMediaSinksObserver : public MediaSinksObserver { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void(const content::PresentationConnectionMessage&, | 98 void(const content::PresentationConnectionMessage&, |
95 OnMessageCallback&)); | 99 OnMessageCallback&)); |
96 MOCK_METHOD1(DidChangeState, | 100 MOCK_METHOD1(DidChangeState, |
97 void(content::PresentationConnectionState state)); | 101 void(content::PresentationConnectionState state)); |
98 MOCK_METHOD0(OnClose, void()); | 102 MOCK_METHOD0(OnClose, void()); |
99 }; | 103 }; |
100 | 104 |
101 } // namespace media_router | 105 } // namespace media_router |
102 | 106 |
103 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ | 107 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ |
OLD | NEW |