| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "chrome/browser/media/router/issues_observer.h" |
| 11 #include "chrome/browser/media/router/media_router.mojom.h" | 12 #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_router_mojo_impl.h" |
| 13 #include "chrome/browser/media/router/media_routes_observer.h" | 14 #include "chrome/browser/media/router/media_routes_observer.h" |
| 14 #include "chrome/browser/media/router/media_sinks_observer.h" | 15 #include "chrome/browser/media/router/media_sinks_observer.h" |
| 15 #include "extensions/browser/event_page_tracker.h" | 16 #include "extensions/browser/event_page_tracker.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 17 | 18 |
| 18 namespace media_router { | 19 namespace media_router { |
| 19 | 20 |
| 20 // Matcher for objects that uses Equals() member function for equality check. | 21 // Matcher for objects that uses Equals() member function for equality check. |
| 21 MATCHER_P(Equals, other, "") { | 22 MATCHER_P(Equals, other, "") { |
| 22 return arg.Equals(other); | 23 return arg.Equals(other); |
| 23 } | 24 } |
| 24 | 25 |
| 25 // Matcher for a sequence of objects that uses Equals() member function for | 26 // Matcher for a sequence of objects that uses Equals() member function for |
| 26 // equality check. | 27 // equality check. |
| 27 MATCHER_P(SequenceEquals, other, "") { | 28 MATCHER_P(SequenceEquals, other, "") { |
| 28 if (arg.size() != other.size()) { | 29 if (arg.size() != other.size()) { |
| 29 return false; | 30 return false; |
| 30 } | 31 } |
| 31 for (size_t i = 0; i < arg.size(); ++i) { | 32 for (size_t i = 0; i < arg.size(); ++i) { |
| 32 if (!arg[i].Equals(other[i])) { | 33 if (!arg[i].Equals(other[i])) { |
| 33 return false; | 34 return false; |
| 34 } | 35 } |
| 35 } | 36 } |
| 36 return true; | 37 return true; |
| 37 } | 38 } |
| 38 | 39 |
| 40 class MockIssuesObserver : public IssuesObserver { |
| 41 public: |
| 42 MockIssuesObserver(MediaRouter* router); |
| 43 ~MockIssuesObserver() override; |
| 44 |
| 45 MOCK_METHOD1(OnIssueUpdated, void(const Issue* issue)); |
| 46 }; |
| 47 |
| 39 class MockMediaRouteProvider : public interfaces::MediaRouteProvider { | 48 class MockMediaRouteProvider : public interfaces::MediaRouteProvider { |
| 40 public: | 49 public: |
| 41 MockMediaRouteProvider(); | 50 MockMediaRouteProvider(); |
| 42 ~MockMediaRouteProvider() override; | 51 ~MockMediaRouteProvider() override; |
| 43 | 52 |
| 44 MOCK_METHOD6(CreateRoute, | 53 MOCK_METHOD6(CreateRoute, |
| 45 void(const mojo::String& source_urn, | 54 void(const mojo::String& source_urn, |
| 46 const mojo::String& sink_id, | 55 const mojo::String& sink_id, |
| 47 const mojo::String& presentation_id, | 56 const mojo::String& presentation_id, |
| 48 const mojo::String& origin, | 57 const mojo::String& origin, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 108 |
| 100 MOCK_METHOD1(IsEventPageSuspended, bool(const std::string& extension_id)); | 109 MOCK_METHOD1(IsEventPageSuspended, bool(const std::string& extension_id)); |
| 101 MOCK_METHOD2(WakeEventPage, | 110 MOCK_METHOD2(WakeEventPage, |
| 102 bool(const std::string& extension_id, | 111 bool(const std::string& extension_id, |
| 103 const base::Callback<void(bool)>& callback)); | 112 const base::Callback<void(bool)>& callback)); |
| 104 }; | 113 }; |
| 105 | 114 |
| 106 } // namespace media_router | 115 } // namespace media_router |
| 107 | 116 |
| 108 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ | 117 #endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_HELPER_H_ |
| OLD | NEW |