OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sync/js/js_test_util.h" | 5 #include "components/sync/js/js_test_util.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "sync/js/js_event_details.h" | 10 #include "components/sync/js/js_event_details.h" |
11 | 11 |
12 namespace syncer { | 12 namespace syncer { |
13 | 13 |
14 void PrintTo(const JsEventDetails& details, ::std::ostream* os) { | 14 void PrintTo(const JsEventDetails& details, ::std::ostream* os) { |
15 *os << details.ToString(); | 15 *os << details.ToString(); |
16 } | 16 } |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // Matcher implementation for HasDetails(). | 20 // Matcher implementation for HasDetails(). |
21 class HasDetailsMatcher | 21 class HasDetailsMatcher |
22 : public ::testing::MatcherInterface<const JsEventDetails&> { | 22 : public ::testing::MatcherInterface<const JsEventDetails&> { |
23 public: | 23 public: |
24 explicit HasDetailsMatcher(const JsEventDetails& expected_details) | 24 explicit HasDetailsMatcher(const JsEventDetails& expected_details) |
25 : expected_details_(expected_details) {} | 25 : expected_details_(expected_details) {} |
26 | 26 |
27 virtual ~HasDetailsMatcher() {} | 27 virtual ~HasDetailsMatcher() {} |
28 | 28 |
29 virtual bool MatchAndExplain( | 29 virtual bool MatchAndExplain(const JsEventDetails& details, |
30 const JsEventDetails& details, | 30 ::testing::MatchResultListener* listener) const { |
31 ::testing::MatchResultListener* listener) const { | |
32 // No need to annotate listener since we already define PrintTo(). | 31 // No need to annotate listener since we already define PrintTo(). |
33 return details.Get().Equals(&expected_details_.Get()); | 32 return details.Get().Equals(&expected_details_.Get()); |
34 } | 33 } |
35 | 34 |
36 virtual void DescribeTo(::std::ostream* os) const { | 35 virtual void DescribeTo(::std::ostream* os) const { |
37 *os << "has details " << expected_details_.ToString(); | 36 *os << "has details " << expected_details_.ToString(); |
38 } | 37 } |
39 | 38 |
40 virtual void DescribeNegationTo(::std::ostream* os) const { | 39 virtual void DescribeNegationTo(::std::ostream* os) const { |
41 *os << "doesn't have details " << expected_details_.ToString(); | 40 *os << "doesn't have details " << expected_details_.ToString(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 74 |
76 MockJsEventHandler::MockJsEventHandler() {} | 75 MockJsEventHandler::MockJsEventHandler() {} |
77 | 76 |
78 WeakHandle<JsEventHandler> MockJsEventHandler::AsWeakHandle() { | 77 WeakHandle<JsEventHandler> MockJsEventHandler::AsWeakHandle() { |
79 return MakeWeakHandle(AsWeakPtr()); | 78 return MakeWeakHandle(AsWeakPtr()); |
80 } | 79 } |
81 | 80 |
82 MockJsEventHandler::~MockJsEventHandler() {} | 81 MockJsEventHandler::~MockJsEventHandler() {} |
83 | 82 |
84 } // namespace syncer | 83 } // namespace syncer |
85 | |
OLD | NEW |