OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 ui_loop_->Run(); | 56 ui_loop_->Run(); |
57 wait_ = false; | 57 wait_ = false; |
58 } | 58 } |
59 | 59 |
60 void Reset() { selected_pages_.clear(); } | 60 void Reset() { selected_pages_.clear(); } |
61 | 61 |
62 const std::string& selected_pages() const { return selected_pages_; } | 62 const std::string& selected_pages() const { return selected_pages_; } |
63 | 63 |
64 private: | 64 private: |
65 // PaginationModelObserver overrides: | 65 // PaginationModelObserver overrides: |
66 virtual void TotalPagesChanged() OVERRIDE { | 66 virtual void TotalPagesChanged() override { |
67 } | 67 } |
68 virtual void SelectedPageChanged(int old_selected, | 68 virtual void SelectedPageChanged(int old_selected, |
69 int new_selected) OVERRIDE { | 69 int new_selected) override { |
70 if (!selected_pages_.empty()) | 70 if (!selected_pages_.empty()) |
71 selected_pages_ += ','; | 71 selected_pages_ += ','; |
72 selected_pages_ += base::IntToString(new_selected); | 72 selected_pages_ += base::IntToString(new_selected); |
73 | 73 |
74 if (wait_) | 74 if (wait_) |
75 ui_loop_->Quit(); | 75 ui_loop_->Quit(); |
76 } | 76 } |
77 virtual void TransitionStarted() OVERRIDE { | 77 virtual void TransitionStarted() override { |
78 } | 78 } |
79 virtual void TransitionChanged() OVERRIDE { | 79 virtual void TransitionChanged() override { |
80 } | 80 } |
81 | 81 |
82 base::MessageLoopForUI* ui_loop_; | 82 base::MessageLoopForUI* ui_loop_; |
83 PaginationModel* model_; | 83 PaginationModel* model_; |
84 bool wait_; | 84 bool wait_; |
85 std::string selected_pages_; | 85 std::string selected_pages_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(PageFlipWaiter); | 87 DISALLOW_COPY_AND_ASSIGN(PageFlipWaiter); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace | 90 } // namespace |
91 | 91 |
92 class AppsGridViewTest : public views::ViewsTestBase { | 92 class AppsGridViewTest : public views::ViewsTestBase { |
93 public: | 93 public: |
94 AppsGridViewTest() {} | 94 AppsGridViewTest() {} |
95 virtual ~AppsGridViewTest() {} | 95 virtual ~AppsGridViewTest() {} |
96 | 96 |
97 // testing::Test overrides: | 97 // testing::Test overrides: |
98 virtual void SetUp() OVERRIDE { | 98 virtual void SetUp() override { |
99 views::ViewsTestBase::SetUp(); | 99 views::ViewsTestBase::SetUp(); |
100 model_.reset(new AppListTestModel); | 100 model_.reset(new AppListTestModel); |
101 model_->SetFoldersEnabled(true); | 101 model_->SetFoldersEnabled(true); |
102 | 102 |
103 apps_grid_view_.reset(new AppsGridView(NULL)); | 103 apps_grid_view_.reset(new AppsGridView(NULL)); |
104 apps_grid_view_->SetLayout(kCols, kRows); | 104 apps_grid_view_->SetLayout(kCols, kRows); |
105 apps_grid_view_->SetBoundsRect(gfx::Rect(gfx::Size(kWidth, kHeight))); | 105 apps_grid_view_->SetBoundsRect(gfx::Rect(gfx::Size(kWidth, kHeight))); |
106 apps_grid_view_->SetModel(model_.get()); | 106 apps_grid_view_->SetModel(model_.get()); |
107 apps_grid_view_->SetItemList(model_->top_level_item_list()); | 107 apps_grid_view_->SetItemList(model_->top_level_item_list()); |
108 | 108 |
109 test_api_.reset(new AppsGridViewTestApi(apps_grid_view_.get())); | 109 test_api_.reset(new AppsGridViewTestApi(apps_grid_view_.get())); |
110 } | 110 } |
111 virtual void TearDown() OVERRIDE { | 111 virtual void TearDown() override { |
112 apps_grid_view_.reset(); // Release apps grid view before models. | 112 apps_grid_view_.reset(); // Release apps grid view before models. |
113 views::ViewsTestBase::TearDown(); | 113 views::ViewsTestBase::TearDown(); |
114 } | 114 } |
115 | 115 |
116 protected: | 116 protected: |
117 void EnsureFoldersEnabled() { | 117 void EnsureFoldersEnabled() { |
118 // Folders require AppList sync to be enabled. | 118 // Folders require AppList sync to be enabled. |
119 CommandLine::ForCurrentProcess()->AppendSwitch( | 119 CommandLine::ForCurrentProcess()->AppendSwitch( |
120 switches::kEnableSyncAppList); | 120 switches::kEnableSyncAppList); |
121 } | 121 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 private: | 182 private: |
183 DISALLOW_COPY_AND_ASSIGN(AppsGridViewTest); | 183 DISALLOW_COPY_AND_ASSIGN(AppsGridViewTest); |
184 }; | 184 }; |
185 | 185 |
186 class TestAppsGridViewFolderDelegate : public AppsGridViewFolderDelegate { | 186 class TestAppsGridViewFolderDelegate : public AppsGridViewFolderDelegate { |
187 public: | 187 public: |
188 TestAppsGridViewFolderDelegate() : show_bubble_(false) {} | 188 TestAppsGridViewFolderDelegate() : show_bubble_(false) {} |
189 virtual ~TestAppsGridViewFolderDelegate() {} | 189 virtual ~TestAppsGridViewFolderDelegate() {} |
190 | 190 |
191 // Overridden from AppsGridViewFolderDelegate: | 191 // Overridden from AppsGridViewFolderDelegate: |
192 virtual void UpdateFolderViewBackground(bool show_bubble) OVERRIDE { | 192 virtual void UpdateFolderViewBackground(bool show_bubble) override { |
193 show_bubble_ = show_bubble; | 193 show_bubble_ = show_bubble; |
194 } | 194 } |
195 | 195 |
196 virtual void ReparentItem(AppListItemView* original_drag_view, | 196 virtual void ReparentItem(AppListItemView* original_drag_view, |
197 const gfx::Point& drag_point_in_folder_grid) | 197 const gfx::Point& drag_point_in_folder_grid) |
198 OVERRIDE {} | 198 override {} |
199 | 199 |
200 virtual void DispatchDragEventForReparent( | 200 virtual void DispatchDragEventForReparent( |
201 AppsGridView::Pointer pointer, | 201 AppsGridView::Pointer pointer, |
202 const gfx::Point& drag_point_in_folder_grid) OVERRIDE {} | 202 const gfx::Point& drag_point_in_folder_grid) override {} |
203 | 203 |
204 virtual void DispatchEndDragEventForReparent( | 204 virtual void DispatchEndDragEventForReparent( |
205 bool events_forwarded_to_drag_drop_host, | 205 bool events_forwarded_to_drag_drop_host, |
206 bool cancel_drag) OVERRIDE {} | 206 bool cancel_drag) override {} |
207 | 207 |
208 virtual bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) | 208 virtual bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) |
209 OVERRIDE { | 209 override { |
210 return false; | 210 return false; |
211 } | 211 } |
212 | 212 |
213 virtual bool IsOEMFolder() const OVERRIDE { return false; } | 213 virtual bool IsOEMFolder() const override { return false; } |
214 | 214 |
215 virtual void SetRootLevelDragViewVisible(bool visible) OVERRIDE {} | 215 virtual void SetRootLevelDragViewVisible(bool visible) override {} |
216 | 216 |
217 bool show_bubble() { return show_bubble_; } | 217 bool show_bubble() { return show_bubble_; } |
218 | 218 |
219 private: | 219 private: |
220 bool show_bubble_; | 220 bool show_bubble_; |
221 | 221 |
222 DISALLOW_COPY_AND_ASSIGN(TestAppsGridViewFolderDelegate); | 222 DISALLOW_COPY_AND_ASSIGN(TestAppsGridViewFolderDelegate); |
223 }; | 223 }; |
224 | 224 |
225 TEST_F(AppsGridViewTest, CreatePage) { | 225 TEST_F(AppsGridViewTest, CreatePage) { |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 AppListItemView* item_view = GetItemViewAt(0); | 791 AppListItemView* item_view = GetItemViewAt(0); |
792 ASSERT_TRUE(item_view); | 792 ASSERT_TRUE(item_view); |
793 const views::Label* title_label = item_view->title(); | 793 const views::Label* title_label = item_view->title(); |
794 EXPECT_FALSE(title_label->GetTooltipText( | 794 EXPECT_FALSE(title_label->GetTooltipText( |
795 title_label->bounds().CenterPoint(), &actual_tooltip)); | 795 title_label->bounds().CenterPoint(), &actual_tooltip)); |
796 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text())); | 796 EXPECT_EQ(title, base::UTF16ToUTF8(title_label->text())); |
797 } | 797 } |
798 | 798 |
799 } // namespace test | 799 } // namespace test |
800 } // namespace app_list | 800 } // namespace app_list |
OLD | NEW |