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 "components/suggestions/suggestions_store.h" | 5 #include "components/suggestions/suggestions_store.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "components/pref_registry/testing_pref_service_syncable.h" | 8 #include "components/pref_registry/testing_pref_service_syncable.h" |
9 #include "components/suggestions/proto/suggestions.pb.h" | 9 #include "components/suggestions/proto/suggestions.pb.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 } // namespace | 70 } // namespace |
71 | 71 |
72 class SuggestionsStoreTest : public testing::Test { | 72 class SuggestionsStoreTest : public testing::Test { |
73 public: | 73 public: |
74 SuggestionsStoreTest() | 74 SuggestionsStoreTest() |
75 : pref_service_(new user_prefs::TestingPrefServiceSyncable) {} | 75 : pref_service_(new user_prefs::TestingPrefServiceSyncable) {} |
76 | 76 |
77 virtual void SetUp() OVERRIDE { | 77 virtual void SetUp() override { |
78 SuggestionsStore::RegisterProfilePrefs(pref_service_->registry()); | 78 SuggestionsStore::RegisterProfilePrefs(pref_service_->registry()); |
79 suggestions_store_.reset(new SuggestionsStore(pref_service_.get())); | 79 suggestions_store_.reset(new SuggestionsStore(pref_service_.get())); |
80 } | 80 } |
81 | 81 |
82 protected: | 82 protected: |
83 scoped_ptr<user_prefs::TestingPrefServiceSyncable> pref_service_; | 83 scoped_ptr<user_prefs::TestingPrefServiceSyncable> pref_service_; |
84 scoped_ptr<SuggestionsStore> suggestions_store_; | 84 scoped_ptr<SuggestionsStore> suggestions_store_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(SuggestionsStoreTest); | 86 DISALLOW_COPY_AND_ASSIGN(SuggestionsStoreTest); |
87 }; | 87 }; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 EXPECT_TRUE(suggestions_store_->LoadSuggestions(&recovered_suggestions)); | 137 EXPECT_TRUE(suggestions_store_->LoadSuggestions(&recovered_suggestions)); |
138 ValidateSuggestions(suggestions, recovered_suggestions); | 138 ValidateSuggestions(suggestions, recovered_suggestions); |
139 | 139 |
140 // Clear. | 140 // Clear. |
141 suggestions_store_->ClearSuggestions(); | 141 suggestions_store_->ClearSuggestions(); |
142 EXPECT_FALSE(suggestions_store_->LoadSuggestions(&recovered_suggestions)); | 142 EXPECT_FALSE(suggestions_store_->LoadSuggestions(&recovered_suggestions)); |
143 ValidateSuggestions(empty_suggestions, recovered_suggestions); | 143 ValidateSuggestions(empty_suggestions, recovered_suggestions); |
144 } | 144 } |
145 | 145 |
146 } // namespace suggestions | 146 } // namespace suggestions |
OLD | NEW |