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

Side by Side Diff: chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
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 <string> 11 #include <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.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/syncable_prefs/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
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (!result_str.empty()) 86 if (!result_str.empty())
87 result_str += ','; 87 result_str += ',';
88 88
89 result_str += base::UTF16ToUTF8(sorted_results[i]->title()); 89 result_str += base::UTF16ToUTF8(sorted_results[i]->title());
90 } 90 }
91 return result_str; 91 return result_str;
92 } 92 }
93 93
94 protected: 94 protected:
95 // Used to store fake suggestions data. 95 // Used to store fake suggestions data.
96 scoped_ptr<SuggestionsStore> suggestions_store_; 96 std::unique_ptr<SuggestionsStore> suggestions_store_;
97 97
98 private: 98 private:
99 // Under test. 99 // Under test.
100 scoped_ptr<SuggestionsSearchProvider> suggestions_search_; 100 std::unique_ptr<SuggestionsSearchProvider> suggestions_search_;
101 101
102 DISALLOW_COPY_AND_ASSIGN(SuggestionsSearchProviderTest); 102 DISALLOW_COPY_AND_ASSIGN(SuggestionsSearchProviderTest);
103 }; 103 };
104 104
105 TEST_F(SuggestionsSearchProviderTest, Basic) { 105 TEST_F(SuggestionsSearchProviderTest, Basic) {
106 EXPECT_EQ("", RunQuery("anything other than empty string")); 106 EXPECT_EQ("", RunQuery("anything other than empty string"));
107 107
108 // Empty query with no suggestions in cache returns nothing. 108 // Empty query with no suggestions in cache returns nothing.
109 EXPECT_EQ("", RunQuery("")); 109 EXPECT_EQ("", RunQuery(""));
110 } 110 }
(...skipping 20 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698