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

Side by Side Diff: ui/app_list/views/search_box_view_unittest.cc

Issue 623293004: replace OVERRIDE and FINAL with override and final in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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
« no previous file with comments | « ui/app_list/views/search_box_view.cc ('k') | ui/app_list/views/search_result_actions_view.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 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 "ui/app_list/views/search_box_view.h" 5 #include "ui/app_list/views/search_box_view.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 #include <map> 8 #include <map>
9 9
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 11 matching lines...) Expand all
22 virtual ~KeyPressCounterView() {} 22 virtual ~KeyPressCounterView() {}
23 23
24 int GetCountAndReset() { 24 int GetCountAndReset() {
25 int count = count_; 25 int count = count_;
26 count_ = 0; 26 count_ = 0;
27 return count; 27 return count;
28 } 28 }
29 29
30 private: 30 private:
31 // Overridden from views::View: 31 // Overridden from views::View:
32 virtual bool OnKeyPressed(const ui::KeyEvent& key_event) OVERRIDE { 32 virtual bool OnKeyPressed(const ui::KeyEvent& key_event) override {
33 if (!::isalnum(static_cast<int>(key_event.key_code()))) { 33 if (!::isalnum(static_cast<int>(key_event.key_code()))) {
34 ++count_; 34 ++count_;
35 return true; 35 return true;
36 } 36 }
37 return false; 37 return false;
38 } 38 }
39 int count_; 39 int count_;
40 40
41 DISALLOW_COPY_AND_ASSIGN(KeyPressCounterView); 41 DISALLOW_COPY_AND_ASSIGN(KeyPressCounterView);
42 }; 42 };
43 43
44 class SearchBoxViewTest : public views::test::WidgetTest, 44 class SearchBoxViewTest : public views::test::WidgetTest,
45 public SearchBoxViewDelegate { 45 public SearchBoxViewDelegate {
46 public: 46 public:
47 SearchBoxViewTest() : query_changed_count_(0) {} 47 SearchBoxViewTest() : query_changed_count_(0) {}
48 virtual ~SearchBoxViewTest() {} 48 virtual ~SearchBoxViewTest() {}
49 49
50 // Overridden from testing::Test: 50 // Overridden from testing::Test:
51 virtual void SetUp() OVERRIDE { 51 virtual void SetUp() override {
52 views::test::WidgetTest::SetUp(); 52 views::test::WidgetTest::SetUp();
53 widget_ = CreateTopLevelPlatformWidget(); 53 widget_ = CreateTopLevelPlatformWidget();
54 view_ = new SearchBoxView(this, &view_delegate_); 54 view_ = new SearchBoxView(this, &view_delegate_);
55 counter_view_ = new KeyPressCounterView(); 55 counter_view_ = new KeyPressCounterView();
56 widget_->GetContentsView()->AddChildView(view_); 56 widget_->GetContentsView()->AddChildView(view_);
57 widget_->GetContentsView()->AddChildView(counter_view_); 57 widget_->GetContentsView()->AddChildView(counter_view_);
58 view_->set_contents_view(counter_view_); 58 view_->set_contents_view(counter_view_);
59 } 59 }
60 60
61 virtual void TearDown() OVERRIDE { 61 virtual void TearDown() override {
62 widget_->CloseNow(); 62 widget_->CloseNow();
63 views::test::WidgetTest::TearDown(); 63 views::test::WidgetTest::TearDown();
64 } 64 }
65 65
66 protected: 66 protected:
67 SearchBoxView* view() { return view_; } 67 SearchBoxView* view() { return view_; }
68 68
69 void SetLongAutoLaunchTimeout() { 69 void SetLongAutoLaunchTimeout() {
70 // Sets a long timeout that lasts longer than the test run. 70 // Sets a long timeout that lasts longer than the test run.
71 view_delegate_.set_auto_launch_timeout(base::TimeDelta::FromDays(1)); 71 view_delegate_.set_auto_launch_timeout(base::TimeDelta::FromDays(1));
(...skipping 28 matching lines...) Expand all
100 } 100 }
101 101
102 int GetQueryChangedCountAndReset() { 102 int GetQueryChangedCountAndReset() {
103 int result = query_changed_count_; 103 int result = query_changed_count_;
104 query_changed_count_ = 0; 104 query_changed_count_ = 0;
105 return result; 105 return result;
106 } 106 }
107 107
108 private: 108 private:
109 // Overridden from SearchBoxViewDelegate: 109 // Overridden from SearchBoxViewDelegate:
110 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE { 110 virtual void QueryChanged(SearchBoxView* sender) override {
111 ++query_changed_count_; 111 ++query_changed_count_;
112 last_query_ = sender->search_box()->text(); 112 last_query_ = sender->search_box()->text();
113 } 113 }
114 114
115 AppListTestViewDelegate view_delegate_; 115 AppListTestViewDelegate view_delegate_;
116 views::Widget* widget_; 116 views::Widget* widget_;
117 SearchBoxView* view_; 117 SearchBoxView* view_;
118 KeyPressCounterView* counter_view_; 118 KeyPressCounterView* counter_view_;
119 base::string16 last_query_; 119 base::string16 last_query_;
120 int query_changed_count_; 120 int query_changed_count_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ResetAutoLaunchTimeout(); 154 ResetAutoLaunchTimeout();
155 155
156 // Clearing search box also cancels. 156 // Clearing search box also cancels.
157 SetLongAutoLaunchTimeout(); 157 SetLongAutoLaunchTimeout();
158 view()->ClearSearch(); 158 view()->ClearSearch();
159 EXPECT_EQ(base::TimeDelta(), GetAutoLaunchTimeout()); 159 EXPECT_EQ(base::TimeDelta(), GetAutoLaunchTimeout());
160 } 160 }
161 161
162 } // namespace test 162 } // namespace test
163 } // namespace app_list 163 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/search_box_view.cc ('k') | ui/app_list/views/search_result_actions_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698