OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 public: | 71 public: |
72 MOCK_METHOD1(Callback, void(const Geoposition& position)); | 72 MOCK_METHOD1(Callback, void(const Geoposition& position)); |
73 }; | 73 }; |
74 | 74 |
75 class GeopositionEqMatcher | 75 class GeopositionEqMatcher |
76 : public MatcherInterface<const Geoposition&> { | 76 : public MatcherInterface<const Geoposition&> { |
77 public: | 77 public: |
78 explicit GeopositionEqMatcher(const Geoposition& expected) | 78 explicit GeopositionEqMatcher(const Geoposition& expected) |
79 : expected_(expected) {} | 79 : expected_(expected) {} |
80 | 80 |
81 virtual bool MatchAndExplain(const Geoposition& actual, | 81 bool MatchAndExplain(const Geoposition& actual, |
82 MatchResultListener* listener) const override { | 82 MatchResultListener* listener) const override { |
83 return actual.latitude == expected_.latitude && | 83 return actual.latitude == expected_.latitude && |
84 actual.longitude == expected_.longitude && | 84 actual.longitude == expected_.longitude && |
85 actual.altitude == expected_.altitude && | 85 actual.altitude == expected_.altitude && |
86 actual.accuracy == expected_.accuracy && | 86 actual.accuracy == expected_.accuracy && |
87 actual.altitude_accuracy == expected_.altitude_accuracy && | 87 actual.altitude_accuracy == expected_.altitude_accuracy && |
88 actual.heading == expected_.heading && | 88 actual.heading == expected_.heading && |
89 actual.speed == expected_.speed && | 89 actual.speed == expected_.speed && |
90 actual.timestamp == expected_.timestamp && | 90 actual.timestamp == expected_.timestamp && |
91 actual.error_code == expected_.error_code && | 91 actual.error_code == expected_.error_code && |
92 actual.error_message == expected_.error_message; | 92 actual.error_message == expected_.error_message; |
93 } | 93 } |
94 | 94 |
95 virtual void DescribeTo(::std::ostream* os) const override { | 95 void DescribeTo(::std::ostream* os) const override { |
96 *os << "which matches the expected position"; | 96 *os << "which matches the expected position"; |
97 } | 97 } |
98 | 98 |
99 virtual void DescribeNegationTo(::std::ostream* os) const override { | 99 void DescribeNegationTo(::std::ostream* os) const override { |
100 *os << "which does not match the expected position"; | 100 *os << "which does not match the expected position"; |
101 } | 101 } |
102 | 102 |
103 private: | 103 private: |
104 Geoposition expected_; | 104 Geoposition expected_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(GeopositionEqMatcher); | 106 DISALLOW_COPY_AND_ASSIGN(GeopositionEqMatcher); |
107 }; | 107 }; |
108 | 108 |
109 Matcher<const Geoposition&> GeopositionEq(const Geoposition& expected) { | 109 Matcher<const Geoposition&> GeopositionEq(const Geoposition& expected) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 &MockGeolocationObserver::OnLocationUpdate, | 249 &MockGeolocationObserver::OnLocationUpdate, |
250 base::Unretained(&mock_observer)); | 250 base::Unretained(&mock_observer)); |
251 scoped_ptr<content::GeolocationProvider::Subscription> subscription = | 251 scoped_ptr<content::GeolocationProvider::Subscription> subscription = |
252 provider()->AddLocationUpdateCallback(callback, false); | 252 provider()->AddLocationUpdateCallback(callback, false); |
253 subscription.reset(); | 253 subscription.reset(); |
254 // Wait for the providers to be stopped now that all clients are gone. | 254 // Wait for the providers to be stopped now that all clients are gone. |
255 EXPECT_FALSE(ProvidersStarted()); | 255 EXPECT_FALSE(ProvidersStarted()); |
256 } | 256 } |
257 | 257 |
258 } // namespace content | 258 } // namespace content |
OLD | NEW |