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 "chrome/browser/ui/app_list/search/suggestions/suggestions_search_provi
der.h" | 5 #include "chrome/browser/ui/app_list/search/suggestions/suggestions_search_provi
der.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/sync/profile_sync_test_util.h" | 16 #include "chrome/browser/sync/profile_sync_test_util.h" |
17 #include "chrome/browser/ui/app_list/app_list_test_util.h" | 17 #include "chrome/browser/ui/app_list/app_list_test_util.h" |
18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
19 #include "components/suggestions/proto/suggestions.pb.h" | 19 #include "components/suggestions/proto/suggestions.pb.h" |
20 #include "components/suggestions/suggestions_store.h" | 20 #include "components/suggestions/suggestions_store.h" |
21 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 21 #include "components/sync_preferences/testing_pref_service_syncable.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "ui/app_list/search_result.h" | 23 #include "ui/app_list/search_result.h" |
24 | 24 |
25 using suggestions::ChromeSuggestion; | 25 using suggestions::ChromeSuggestion; |
26 using suggestions::SuggestionsProfile; | 26 using suggestions::SuggestionsProfile; |
27 using suggestions::SuggestionsStore; | 27 using suggestions::SuggestionsStore; |
28 | 28 |
29 namespace app_list { | 29 namespace app_list { |
30 namespace test { | 30 namespace test { |
31 | 31 |
(...skipping 22 matching lines...) Expand all Loading... |
54 ~SuggestionsSearchProviderTest() override {} | 54 ~SuggestionsSearchProviderTest() override {} |
55 | 55 |
56 // AppListTestBase overrides: | 56 // AppListTestBase overrides: |
57 void SetUp() override { | 57 void SetUp() override { |
58 AppListTestBase::SetUp(); | 58 AppListTestBase::SetUp(); |
59 | 59 |
60 profile_ = MakeSignedInTestingProfile(); | 60 profile_ = MakeSignedInTestingProfile(); |
61 suggestions_search_.reset( | 61 suggestions_search_.reset( |
62 new SuggestionsSearchProvider(profile_.get(), NULL)); | 62 new SuggestionsSearchProvider(profile_.get(), NULL)); |
63 | 63 |
64 syncable_prefs::TestingPrefServiceSyncable* pref_service = | 64 sync_preferences::TestingPrefServiceSyncable* pref_service = |
65 profile_->GetTestingPrefService(); | 65 profile_->GetTestingPrefService(); |
66 suggestions_store_.reset(new SuggestionsStore(pref_service)); | 66 suggestions_store_.reset(new SuggestionsStore(pref_service)); |
67 } | 67 } |
68 | 68 |
69 void TearDown() override { | 69 void TearDown() override { |
70 // Making sure suggestions are cleared between tests. | 70 // Making sure suggestions are cleared between tests. |
71 suggestions_store_->ClearSuggestions(); | 71 suggestions_store_->ClearSuggestions(); |
72 profile_.reset(); | 72 profile_.reset(); |
73 } | 73 } |
74 | 74 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // those suggestions, with "foo" being more relevant since it came first in | 131 // those suggestions, with "foo" being more relevant since it came first in |
132 // the suggestions profile. | 132 // the suggestions profile. |
133 EXPECT_EQ("foo,bar", RunQuery("")); | 133 EXPECT_EQ("foo,bar", RunQuery("")); |
134 | 134 |
135 // Non-empty query returns nothing. | 135 // Non-empty query returns nothing. |
136 EXPECT_EQ("", RunQuery("t")); | 136 EXPECT_EQ("", RunQuery("t")); |
137 } | 137 } |
138 | 138 |
139 } // namespace test | 139 } // namespace test |
140 } // namespace app_list | 140 } // namespace app_list |
OLD | NEW |