Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: components/sync/base/model_type_test_util.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/sync/base/model_type_test_util.h ('k') | components/sync/base/nigori.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/macros.h" 5 #include "base/macros.h"
6 #include "sync/internal_api/public/base/model_type_test_util.h" 6 #include "components/sync/base/model_type_test_util.h"
7 7
8 namespace syncer { 8 namespace syncer {
9 9
10 void PrintTo(ModelTypeSet model_types, ::std::ostream* os) { 10 void PrintTo(ModelTypeSet model_types, ::std::ostream* os) {
11 *os << ModelTypeSetToString(model_types); 11 *os << ModelTypeSetToString(model_types);
12 } 12 }
13 13
14 namespace { 14 namespace {
15 15
16 // Matcher implementation for HasModelTypes(). 16 // Matcher implementation for HasModelTypes().
17 class HasModelTypesMatcher 17 class HasModelTypesMatcher : public ::testing::MatcherInterface<ModelTypeSet> {
18 : public ::testing::MatcherInterface<ModelTypeSet> {
19 public: 18 public:
20 explicit HasModelTypesMatcher(ModelTypeSet expected_types) 19 explicit HasModelTypesMatcher(ModelTypeSet expected_types)
21 : expected_types_(expected_types) {} 20 : expected_types_(expected_types) {}
22 21
23 virtual ~HasModelTypesMatcher() {} 22 virtual ~HasModelTypesMatcher() {}
24 23
25 virtual bool MatchAndExplain( 24 virtual bool MatchAndExplain(ModelTypeSet model_types,
26 ModelTypeSet model_types, 25 ::testing::MatchResultListener* listener) const {
27 ::testing::MatchResultListener* listener) const {
28 // No need to annotate listener since we already define PrintTo(). 26 // No need to annotate listener since we already define PrintTo().
29 return model_types == expected_types_; 27 return model_types == expected_types_;
30 } 28 }
31 29
32 virtual void DescribeTo(::std::ostream* os) const { 30 virtual void DescribeTo(::std::ostream* os) const {
33 *os << "has model types " << ModelTypeSetToString(expected_types_); 31 *os << "has model types " << ModelTypeSetToString(expected_types_);
34 } 32 }
35 33
36 virtual void DescribeNegationTo(::std::ostream* os) const { 34 virtual void DescribeNegationTo(::std::ostream* os) const {
37 *os << "doesn't have model types " 35 *os << "doesn't have model types " << ModelTypeSetToString(expected_types_);
38 << ModelTypeSetToString(expected_types_);
39 } 36 }
40 37
41 private: 38 private:
42 const ModelTypeSet expected_types_; 39 const ModelTypeSet expected_types_;
43 40
44 DISALLOW_COPY_AND_ASSIGN(HasModelTypesMatcher); 41 DISALLOW_COPY_AND_ASSIGN(HasModelTypesMatcher);
45 }; 42 };
46 43
47 } // namespace 44 } // namespace
48 45
49 ::testing::Matcher<ModelTypeSet> HasModelTypes(ModelTypeSet expected_types) { 46 ::testing::Matcher<ModelTypeSet> HasModelTypes(ModelTypeSet expected_types) {
50 return ::testing::MakeMatcher(new HasModelTypesMatcher(expected_types)); 47 return ::testing::MakeMatcher(new HasModelTypesMatcher(expected_types));
51 } 48 }
52 49
53 } // namespace syncer 50 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/base/model_type_test_util.h ('k') | components/sync/base/nigori.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698