| 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 return false; | 32 return false; |
| 33 } | 33 } |
| 34 for (size_t i = 0; i < arg.size(); ++i) { | 34 for (size_t i = 0; i < arg.size(); ++i) { |
| 35 if (!arg[i].Equals(other[i])) { | 35 if (!arg[i].Equals(other[i])) { |
| 36 return false; | 36 return false; |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Matcher for checking all fields in Issue objects except the ID. | 42 // Matcher for IssueInfo title. |
| 43 MATCHER_P(EqualsIssue, other, "") { | |
| 44 if (arg.title() != other.title()) | |
| 45 return false; | |
| 46 | |
| 47 if (arg.message() != other.message()) | |
| 48 return false; | |
| 49 | |
| 50 if (!arg.default_action().Equals(other.default_action())) | |
| 51 return false; | |
| 52 | |
| 53 if (arg.secondary_actions().size() != other.secondary_actions().size()) | |
| 54 return false; | |
| 55 | |
| 56 for (size_t i = 0; i < arg.secondary_actions().size(); ++i) { | |
| 57 if (!arg.secondary_actions()[i].Equals(other.secondary_actions()[i])) | |
| 58 return false; | |
| 59 } | |
| 60 | |
| 61 if (arg.route_id() != other.route_id()) | |
| 62 return false; | |
| 63 | |
| 64 if (arg.severity() != other.severity()) | |
| 65 return false; | |
| 66 | |
| 67 if (arg.is_blocking() != other.is_blocking()) | |
| 68 return false; | |
| 69 | |
| 70 if (arg.help_page_id() != other.help_page_id()) | |
| 71 return false; | |
| 72 | |
| 73 return true; | |
| 74 } | |
| 75 | |
| 76 MATCHER_P(IssueTitleEquals, title, "") { | 43 MATCHER_P(IssueTitleEquals, title, "") { |
| 77 return arg.title() == title; | 44 return arg.title == title; |
| 78 } | 45 } |
| 79 | 46 |
| 80 MATCHER_P(StateChangeInfoEquals, other, "") { | 47 MATCHER_P(StateChangeInfoEquals, other, "") { |
| 81 return arg.state == other.state && arg.close_reason == other.close_reason && | 48 return arg.state == other.state && arg.close_reason == other.close_reason && |
| 82 arg.message == other.message; | 49 arg.message == other.message; |
| 83 } | 50 } |
| 84 | 51 |
| 85 class MockIssuesObserver : public IssuesObserver { | 52 class MockIssuesObserver : public IssuesObserver { |
| 86 public: | 53 public: |
| 87 explicit MockIssuesObserver(MediaRouter* router); | 54 explicit MockIssuesObserver(MediaRouter* router); |
| 88 ~MockIssuesObserver() override; | 55 ~MockIssuesObserver() override; |
| 89 | 56 |
| 90 MOCK_METHOD1(OnIssueUpdated, void(const Issue* issue)); | 57 MOCK_METHOD1(OnIssue, void(const Issue& issue)); |
| 58 MOCK_METHOD0(OnIssuesCleared, void()); |
| 91 }; | 59 }; |
| 92 | 60 |
| 93 class MockMediaSinksObserver : public MediaSinksObserver { | 61 class MockMediaSinksObserver : public MediaSinksObserver { |
| 94 public: | 62 public: |
| 95 MockMediaSinksObserver(MediaRouter* router, | 63 MockMediaSinksObserver(MediaRouter* router, |
| 96 const MediaSource& source, | 64 const MediaSource& source, |
| 97 const GURL& origin); | 65 const GURL& origin); |
| 98 ~MockMediaSinksObserver() override; | 66 ~MockMediaSinksObserver() override; |
| 99 | 67 |
| 100 MOCK_METHOD1(OnSinksReceived, void(const std::vector<MediaSink>& sinks)); | 68 MOCK_METHOD1(OnSinksReceived, void(const std::vector<MediaSink>& sinks)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 114 public: | 82 public: |
| 115 MockPresentationConnectionStateChangedCallback(); | 83 MockPresentationConnectionStateChangedCallback(); |
| 116 ~MockPresentationConnectionStateChangedCallback(); | 84 ~MockPresentationConnectionStateChangedCallback(); |
| 117 MOCK_METHOD1(Run, | 85 MOCK_METHOD1(Run, |
| 118 void(const content::PresentationConnectionStateChangeInfo&)); | 86 void(const content::PresentationConnectionStateChangeInfo&)); |
| 119 }; | 87 }; |
| 120 | 88 |
| 121 } // namespace media_router | 89 } // namespace media_router |
| 122 | 90 |
| 123 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ | 91 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ |
| OLD | NEW |