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

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

Issue 681873002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/apps_grid_view.cc ('k') | ui/app_list/views/cached_label.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/apps_grid_view.h" 5 #include "ui/app_list/views/apps_grid_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 27 matching lines...) Expand all
38 const int kWidth = 320; 38 const int kWidth = 320;
39 const int kHeight = 240; 39 const int kHeight = 240;
40 40
41 class PageFlipWaiter : public PaginationModelObserver { 41 class PageFlipWaiter : public PaginationModelObserver {
42 public: 42 public:
43 PageFlipWaiter(base::MessageLoopForUI* ui_loop, PaginationModel* model) 43 PageFlipWaiter(base::MessageLoopForUI* ui_loop, PaginationModel* model)
44 : ui_loop_(ui_loop), model_(model), wait_(false) { 44 : ui_loop_(ui_loop), model_(model), wait_(false) {
45 model_->AddObserver(this); 45 model_->AddObserver(this);
46 } 46 }
47 47
48 virtual ~PageFlipWaiter() { 48 ~PageFlipWaiter() override { model_->RemoveObserver(this); }
49 model_->RemoveObserver(this);
50 }
51 49
52 void Wait() { 50 void Wait() {
53 DCHECK(!wait_); 51 DCHECK(!wait_);
54 wait_ = true; 52 wait_ = true;
55 53
56 ui_loop_->Run(); 54 ui_loop_->Run();
57 wait_ = false; 55 wait_ = false;
58 } 56 }
59 57
60 void Reset() { selected_pages_.clear(); } 58 void Reset() { selected_pages_.clear(); }
61 59
62 const std::string& selected_pages() const { return selected_pages_; } 60 const std::string& selected_pages() const { return selected_pages_; }
63 61
64 private: 62 private:
65 // PaginationModelObserver overrides: 63 // PaginationModelObserver overrides:
66 virtual void TotalPagesChanged() override { 64 void TotalPagesChanged() override {}
67 } 65 void SelectedPageChanged(int old_selected, int new_selected) override {
68 virtual void SelectedPageChanged(int old_selected,
69 int new_selected) override {
70 if (!selected_pages_.empty()) 66 if (!selected_pages_.empty())
71 selected_pages_ += ','; 67 selected_pages_ += ',';
72 selected_pages_ += base::IntToString(new_selected); 68 selected_pages_ += base::IntToString(new_selected);
73 69
74 if (wait_) 70 if (wait_)
75 ui_loop_->Quit(); 71 ui_loop_->Quit();
76 } 72 }
77 virtual void TransitionStarted() override { 73 void TransitionStarted() override {}
78 } 74 void TransitionChanged() override {}
79 virtual void TransitionChanged() override {
80 }
81 75
82 base::MessageLoopForUI* ui_loop_; 76 base::MessageLoopForUI* ui_loop_;
83 PaginationModel* model_; 77 PaginationModel* model_;
84 bool wait_; 78 bool wait_;
85 std::string selected_pages_; 79 std::string selected_pages_;
86 80
87 DISALLOW_COPY_AND_ASSIGN(PageFlipWaiter); 81 DISALLOW_COPY_AND_ASSIGN(PageFlipWaiter);
88 }; 82 };
89 83
90 } // namespace 84 } // namespace
91 85
92 class AppsGridViewTest : public views::ViewsTestBase { 86 class AppsGridViewTest : public views::ViewsTestBase {
93 public: 87 public:
94 AppsGridViewTest() {} 88 AppsGridViewTest() {}
95 virtual ~AppsGridViewTest() {} 89 ~AppsGridViewTest() override {}
96 90
97 // testing::Test overrides: 91 // testing::Test overrides:
98 virtual void SetUp() override { 92 void SetUp() override {
99 views::ViewsTestBase::SetUp(); 93 views::ViewsTestBase::SetUp();
100 model_.reset(new AppListTestModel); 94 model_.reset(new AppListTestModel);
101 model_->SetFoldersEnabled(true); 95 model_->SetFoldersEnabled(true);
102 96
103 apps_grid_view_.reset(new AppsGridView(NULL)); 97 apps_grid_view_.reset(new AppsGridView(NULL));
104 apps_grid_view_->SetLayout(kCols, kRows); 98 apps_grid_view_->SetLayout(kCols, kRows);
105 apps_grid_view_->SetBoundsRect(gfx::Rect(gfx::Size(kWidth, kHeight))); 99 apps_grid_view_->SetBoundsRect(gfx::Rect(gfx::Size(kWidth, kHeight)));
106 apps_grid_view_->SetModel(model_.get()); 100 apps_grid_view_->SetModel(model_.get());
107 apps_grid_view_->SetItemList(model_->top_level_item_list()); 101 apps_grid_view_->SetItemList(model_->top_level_item_list());
108 102
109 test_api_.reset(new AppsGridViewTestApi(apps_grid_view_.get())); 103 test_api_.reset(new AppsGridViewTestApi(apps_grid_view_.get()));
110 } 104 }
111 virtual void TearDown() override { 105 void TearDown() override {
112 apps_grid_view_.reset(); // Release apps grid view before models. 106 apps_grid_view_.reset(); // Release apps grid view before models.
113 views::ViewsTestBase::TearDown(); 107 views::ViewsTestBase::TearDown();
114 } 108 }
115 109
116 protected: 110 protected:
117 void EnsureFoldersEnabled() { 111 void EnsureFoldersEnabled() {
118 // Folders require AppList sync to be enabled. 112 // Folders require AppList sync to be enabled.
119 CommandLine::ForCurrentProcess()->AppendSwitch( 113 CommandLine::ForCurrentProcess()->AppendSwitch(
120 switches::kEnableSyncAppList); 114 switches::kEnableSyncAppList);
121 } 115 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 scoped_ptr<AppsGridView> apps_grid_view_; 173 scoped_ptr<AppsGridView> apps_grid_view_;
180 scoped_ptr<AppsGridViewTestApi> test_api_; 174 scoped_ptr<AppsGridViewTestApi> test_api_;
181 175
182 private: 176 private:
183 DISALLOW_COPY_AND_ASSIGN(AppsGridViewTest); 177 DISALLOW_COPY_AND_ASSIGN(AppsGridViewTest);
184 }; 178 };
185 179
186 class TestAppsGridViewFolderDelegate : public AppsGridViewFolderDelegate { 180 class TestAppsGridViewFolderDelegate : public AppsGridViewFolderDelegate {
187 public: 181 public:
188 TestAppsGridViewFolderDelegate() : show_bubble_(false) {} 182 TestAppsGridViewFolderDelegate() : show_bubble_(false) {}
189 virtual ~TestAppsGridViewFolderDelegate() {} 183 ~TestAppsGridViewFolderDelegate() override {}
190 184
191 // Overridden from AppsGridViewFolderDelegate: 185 // Overridden from AppsGridViewFolderDelegate:
192 virtual void UpdateFolderViewBackground(bool show_bubble) override { 186 void UpdateFolderViewBackground(bool show_bubble) override {
193 show_bubble_ = show_bubble; 187 show_bubble_ = show_bubble;
194 } 188 }
195 189
196 virtual void ReparentItem(AppListItemView* original_drag_view, 190 void ReparentItem(AppListItemView* original_drag_view,
197 const gfx::Point& drag_point_in_folder_grid) 191 const gfx::Point& drag_point_in_folder_grid) override {}
198 override {}
199 192
200 virtual void DispatchDragEventForReparent( 193 void DispatchDragEventForReparent(
201 AppsGridView::Pointer pointer, 194 AppsGridView::Pointer pointer,
202 const gfx::Point& drag_point_in_folder_grid) override {} 195 const gfx::Point& drag_point_in_folder_grid) override {}
203 196
204 virtual void DispatchEndDragEventForReparent( 197 void DispatchEndDragEventForReparent(bool events_forwarded_to_drag_drop_host,
205 bool events_forwarded_to_drag_drop_host, 198 bool cancel_drag) override {}
206 bool cancel_drag) override {}
207 199
208 virtual bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) 200 bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) override {
209 override {
210 return false; 201 return false;
211 } 202 }
212 203
213 virtual bool IsOEMFolder() const override { return false; } 204 bool IsOEMFolder() const override { return false; }
214 205
215 virtual void SetRootLevelDragViewVisible(bool visible) override {} 206 void SetRootLevelDragViewVisible(bool visible) override {}
216 207
217 bool show_bubble() { return show_bubble_; } 208 bool show_bubble() { return show_bubble_; }
218 209
219 private: 210 private:
220 bool show_bubble_; 211 bool show_bubble_;
221 212
222 DISALLOW_COPY_AND_ASSIGN(TestAppsGridViewFolderDelegate); 213 DISALLOW_COPY_AND_ASSIGN(TestAppsGridViewFolderDelegate);
223 }; 214 };
224 215
225 TEST_F(AppsGridViewTest, CreatePage) { 216 TEST_F(AppsGridViewTest, CreatePage) {
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 AppListItemView* item_view = GetItemViewAt(0); 782 AppListItemView* item_view = GetItemViewAt(0);
792 ASSERT_TRUE(item_view); 783 ASSERT_TRUE(item_view);
793 const views::Label* title_label = item_view->title(); 784 const views::Label* title_label = item_view->title();
794 EXPECT_FALSE(title_label->GetTooltipText( 785 EXPECT_FALSE(title_label->GetTooltipText(
795 title_label->bounds().CenterPoint(), &actual_tooltip)); 786 title_label->bounds().CenterPoint(), &actual_tooltip));
796 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text())); 787 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text()));
797 } 788 }
798 789
799 } // namespace test 790 } // namespace test
800 } // namespace app_list 791 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/apps_grid_view.cc ('k') | ui/app_list/views/cached_label.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698