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

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

Issue 627043002: replace OVERRIDE and FINAL with override and final in chrome/browser/ui/[a-s]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <string>
6 6
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 11 matching lines...) Expand all
22 public: 22 public:
23 TestSearchResult(const std::string& id, double relevance) 23 TestSearchResult(const std::string& id, double relevance)
24 : instance_id_(instantiation_count++) { 24 : instance_id_(instantiation_count++) {
25 set_id(id); 25 set_id(id);
26 set_title(base::UTF8ToUTF16(id)); 26 set_title(base::UTF8ToUTF16(id));
27 set_relevance(relevance); 27 set_relevance(relevance);
28 } 28 }
29 virtual ~TestSearchResult() {} 29 virtual ~TestSearchResult() {}
30 30
31 // ChromeSearchResult overides: 31 // ChromeSearchResult overides:
32 virtual void Open(int event_flags) OVERRIDE {} 32 virtual void Open(int event_flags) override {}
33 virtual void InvokeAction(int action_index, int event_flags) OVERRIDE {} 33 virtual void InvokeAction(int action_index, int event_flags) override {}
34 virtual scoped_ptr<ChromeSearchResult> Duplicate() OVERRIDE { 34 virtual scoped_ptr<ChromeSearchResult> Duplicate() override {
35 return scoped_ptr<ChromeSearchResult>( 35 return scoped_ptr<ChromeSearchResult>(
36 new TestSearchResult(id(), relevance())).Pass(); 36 new TestSearchResult(id(), relevance())).Pass();
37 } 37 }
38 virtual ChromeSearchResultType GetType() OVERRIDE { 38 virtual ChromeSearchResultType GetType() override {
39 return SEARCH_RESULT_TYPE_BOUNDARY; 39 return SEARCH_RESULT_TYPE_BOUNDARY;
40 } 40 }
41 41
42 // For reference equality testing. (Addresses cannot be used to test reference 42 // For reference equality testing. (Addresses cannot be used to test reference
43 // equality because it is possible that an object will be allocated at the 43 // equality because it is possible that an object will be allocated at the
44 // same address as a previously deleted one.) 44 // same address as a previously deleted one.)
45 static int GetInstanceId(SearchResult* result) { 45 static int GetInstanceId(SearchResult* result) {
46 return static_cast<const TestSearchResult*>(result)->instance_id_; 46 return static_cast<const TestSearchResult*>(result)->instance_id_;
47 } 47 }
48 48
49 private: 49 private:
50 static int instantiation_count; 50 static int instantiation_count;
51 51
52 int instance_id_; 52 int instance_id_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(TestSearchResult); 54 DISALLOW_COPY_AND_ASSIGN(TestSearchResult);
55 }; 55 };
56 int TestSearchResult::instantiation_count = 0; 56 int TestSearchResult::instantiation_count = 0;
57 57
58 class TestSearchProvider : public SearchProvider { 58 class TestSearchProvider : public SearchProvider {
59 public: 59 public:
60 explicit TestSearchProvider(const std::string& prefix) 60 explicit TestSearchProvider(const std::string& prefix)
61 : prefix_(prefix), 61 : prefix_(prefix),
62 count_(0) {} 62 count_(0) {}
63 virtual ~TestSearchProvider() {} 63 virtual ~TestSearchProvider() {}
64 64
65 // SearchProvider overrides: 65 // SearchProvider overrides:
66 virtual void Start(const base::string16& query) OVERRIDE { 66 virtual void Start(const base::string16& query) override {
67 ClearResults(); 67 ClearResults();
68 for (size_t i = 0; i < count_; ++i) { 68 for (size_t i = 0; i < count_; ++i) {
69 const std::string id = 69 const std::string id =
70 base::StringPrintf("%s%d", prefix_.c_str(), static_cast<int>(i)); 70 base::StringPrintf("%s%d", prefix_.c_str(), static_cast<int>(i));
71 const double relevance = 1.0 - i / 10.0; 71 const double relevance = 1.0 - i / 10.0;
72 Add(scoped_ptr<SearchResult>(new TestSearchResult(id, relevance)).Pass()); 72 Add(scoped_ptr<SearchResult>(new TestSearchResult(id, relevance)).Pass());
73 } 73 }
74 } 74 }
75 virtual void Stop() OVERRIDE {} 75 virtual void Stop() override {}
76 76
77 void set_prefix(const std::string& prefix) { prefix_ = prefix; } 77 void set_prefix(const std::string& prefix) { prefix_ = prefix; }
78 void set_count(size_t count) { count_ = count; } 78 void set_count(size_t count) { count_ = count; }
79 79
80 private: 80 private:
81 std::string prefix_; 81 std::string prefix_;
82 size_t count_; 82 size_t count_;
83 83
84 DISALLOW_COPY_AND_ASSIGN(TestSearchProvider); 84 DISALLOW_COPY_AND_ASSIGN(TestSearchProvider);
85 }; 85 };
86 86
87 class MixerTest : public testing::Test { 87 class MixerTest : public testing::Test {
88 public: 88 public:
89 MixerTest() {} 89 MixerTest() {}
90 virtual ~MixerTest() {} 90 virtual ~MixerTest() {}
91 91
92 // testing::Test overrides: 92 // testing::Test overrides:
93 virtual void SetUp() OVERRIDE { 93 virtual void SetUp() override {
94 results_.reset(new AppListModel::SearchResults); 94 results_.reset(new AppListModel::SearchResults);
95 95
96 providers_.push_back(new TestSearchProvider("app")); 96 providers_.push_back(new TestSearchProvider("app"));
97 providers_.push_back(new TestSearchProvider("omnibox")); 97 providers_.push_back(new TestSearchProvider("omnibox"));
98 providers_.push_back(new TestSearchProvider("webstore")); 98 providers_.push_back(new TestSearchProvider("webstore"));
99 providers_.push_back(new TestSearchProvider("people")); 99 providers_.push_back(new TestSearchProvider("people"));
100 100
101 mixer_.reset(new Mixer(results_.get())); 101 mixer_.reset(new Mixer(results_.get()));
102 mixer_->Init(); 102 mixer_->Init();
103 mixer_->AddProviderToGroup(Mixer::MAIN_GROUP, providers_[0]); 103 mixer_->AddProviderToGroup(Mixer::MAIN_GROUP, providers_[0]);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 EXPECT_EQ(old_ui_result_ids[0], 278 EXPECT_EQ(old_ui_result_ids[0],
279 TestSearchResult::GetInstanceId(ui_results.GetItemAt(3))); 279 TestSearchResult::GetInstanceId(ui_results.GetItemAt(3)));
280 EXPECT_EQ(old_ui_result_ids[1], 280 EXPECT_EQ(old_ui_result_ids[1],
281 TestSearchResult::GetInstanceId(ui_results.GetItemAt(0))); 281 TestSearchResult::GetInstanceId(ui_results.GetItemAt(0)));
282 EXPECT_EQ(old_ui_result_ids[2], 282 EXPECT_EQ(old_ui_result_ids[2],
283 TestSearchResult::GetInstanceId(ui_results.GetItemAt(2))); 283 TestSearchResult::GetInstanceId(ui_results.GetItemAt(2)));
284 } 284 }
285 285
286 } // namespace test 286 } // namespace test
287 } // namespace app_list 287 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/search/history_unittest.cc ('k') | chrome/browser/ui/app_list/search/omnibox_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698