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

Side by Side Diff: ash/shelf/shelf_view_unittest.cc

Issue 71653003: ash: Rename LauncherModel to ShelfModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chrome changes Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/shelf/shelf_widget.cc » ('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 "ash/shelf/shelf_view.h" 5 #include "ash/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/launcher/launcher.h" 11 #include "ash/launcher/launcher.h"
12 #include "ash/launcher/launcher_button.h" 12 #include "ash/launcher/launcher_button.h"
13 #include "ash/launcher/launcher_item_delegate_manager.h" 13 #include "ash/launcher/launcher_item_delegate_manager.h"
14 #include "ash/launcher/launcher_model.h"
15 #include "ash/launcher/launcher_types.h" 14 #include "ash/launcher/launcher_types.h"
16 #include "ash/root_window_controller.h" 15 #include "ash/root_window_controller.h"
17 #include "ash/shelf/overflow_bubble.h" 16 #include "ash/shelf/overflow_bubble.h"
18 #include "ash/shelf/shelf_icon_observer.h" 17 #include "ash/shelf/shelf_icon_observer.h"
19 #include "ash/shelf/shelf_layout_manager.h" 18 #include "ash/shelf/shelf_layout_manager.h"
19 #include "ash/shelf/shelf_model.h"
20 #include "ash/shelf/shelf_tooltip_manager.h" 20 #include "ash/shelf/shelf_tooltip_manager.h"
21 #include "ash/shelf/shelf_widget.h" 21 #include "ash/shelf/shelf_widget.h"
22 #include "ash/shell.h" 22 #include "ash/shell.h"
23 #include "ash/shell_window_ids.h" 23 #include "ash/shell_window_ids.h"
24 #include "ash/test/ash_test_base.h" 24 #include "ash/test/ash_test_base.h"
25 #include "ash/test/launcher_test_api.h" 25 #include "ash/test/launcher_test_api.h"
26 #include "ash/test/shelf_view_test_api.h" 26 #include "ash/test/shelf_view_test_api.h"
27 #include "ash/test/shell_test_api.h" 27 #include "ash/test/shell_test_api.h"
28 #include "ash/test/test_launcher_delegate.h" 28 #include "ash/test/test_launcher_delegate.h"
29 #include "ash/test/test_launcher_item_delegate.h" 29 #include "ash/test/test_launcher_item_delegate.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 //////////////////////////////////////////////////////////////////////////////// 197 ////////////////////////////////////////////////////////////////////////////////
198 // ShelfView tests. 198 // ShelfView tests.
199 199
200 // LauncherItemDelegate for ShelfViewTest.OverflowBubbleSize only. 200 // LauncherItemDelegate for ShelfViewTest.OverflowBubbleSize only.
201 // To test ripping off an item in OverflowBubbleSize, all item should be 201 // To test ripping off an item in OverflowBubbleSize, all item should be
202 // pinned. 202 // pinned.
203 class TestLauncherDelegateForShelfView : public TestLauncherDelegate { 203 class TestLauncherDelegateForShelfView : public TestLauncherDelegate {
204 public: 204 public:
205 explicit TestLauncherDelegateForShelfView(LauncherModel* model) 205 explicit TestLauncherDelegateForShelfView(ShelfModel* model)
206 : TestLauncherDelegate(model) {} 206 : TestLauncherDelegate(model) {}
207 virtual ~TestLauncherDelegateForShelfView() {} 207 virtual ~TestLauncherDelegateForShelfView() {}
208 208
209 // TestLauncherDelegate overrides: 209 // TestLauncherDelegate overrides:
210 virtual bool IsAppPinned(const std::string& app_id) OVERRIDE { 210 virtual bool IsAppPinned(const std::string& app_id) OVERRIDE {
211 // Returns true for ShelfViewTest.OverflowBubbleSize. To test ripping off in 211 // Returns true for ShelfViewTest.OverflowBubbleSize. To test ripping off in
212 // that test, an item is already pinned state. 212 // that test, an item is already pinned state.
213 return true; 213 return true;
214 } 214 }
215 215
216 private: 216 private:
217 DISALLOW_COPY_AND_ASSIGN(TestLauncherDelegateForShelfView); 217 DISALLOW_COPY_AND_ASSIGN(TestLauncherDelegateForShelfView);
218 }; 218 };
219 219
220 class ShelfViewTest : public AshTestBase { 220 class ShelfViewTest : public AshTestBase {
221 public: 221 public:
222 ShelfViewTest() : model_(NULL), shelf_view_(NULL), browser_index_(1) {} 222 ShelfViewTest() : model_(NULL), shelf_view_(NULL), browser_index_(1) {}
223 virtual ~ShelfViewTest() {} 223 virtual ~ShelfViewTest() {}
224 224
225 virtual void SetUp() OVERRIDE { 225 virtual void SetUp() OVERRIDE {
226 AshTestBase::SetUp(); 226 AshTestBase::SetUp();
227 test::ShellTestApi test_api(Shell::GetInstance()); 227 test::ShellTestApi test_api(Shell::GetInstance());
228 model_ = test_api.launcher_model(); 228 model_ = test_api.shelf_model();
229 Launcher* launcher = Launcher::ForPrimaryDisplay(); 229 Launcher* launcher = Launcher::ForPrimaryDisplay();
230 shelf_view_ = test::LauncherTestAPI(launcher).shelf_view(); 230 shelf_view_ = test::LauncherTestAPI(launcher).shelf_view();
231 231
232 // The bounds should be big enough for 4 buttons + overflow chevron. 232 // The bounds should be big enough for 4 buttons + overflow chevron.
233 shelf_view_->SetBounds(0, 0, 500, 233 shelf_view_->SetBounds(0, 0, 500,
234 internal::ShelfLayoutManager::GetPreferredShelfSize()); 234 internal::ShelfLayoutManager::GetPreferredShelfSize());
235 235
236 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); 236 test_api_.reset(new ShelfViewTestAPI(shelf_view_));
237 test_api_->SetAnimationDuration(1); // Speeds up animation for test. 237 test_api_->SetAnimationDuration(1); // Speeds up animation for test.
238 238
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 414 }
415 415
416 views::View* GetTooltipAnchorView() { 416 views::View* GetTooltipAnchorView() {
417 return shelf_view_->tooltip_manager()->anchor_; 417 return shelf_view_->tooltip_manager()->anchor_;
418 } 418 }
419 419
420 void ShowTooltip() { 420 void ShowTooltip() {
421 shelf_view_->tooltip_manager()->ShowInternal(); 421 shelf_view_->tooltip_manager()->ShowInternal();
422 } 422 }
423 423
424 LauncherModel* model_; 424 ShelfModel* model_;
425 internal::ShelfView* shelf_view_; 425 internal::ShelfView* shelf_view_;
426 int browser_index_; 426 int browser_index_;
427 LauncherItemDelegateManager* item_manager_; 427 LauncherItemDelegateManager* item_manager_;
428 428
429 scoped_ptr<ShelfViewTestAPI> test_api_; 429 scoped_ptr<ShelfViewTestAPI> test_api_;
430 430
431 private: 431 private:
432 DISALLOW_COPY_AND_ASSIGN(ShelfViewTest); 432 DISALLOW_COPY_AND_ASSIGN(ShelfViewTest);
433 }; 433 };
434 434
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 test_api_->RunMessageLoopUntilAnimationsDone(); 1454 test_api_->RunMessageLoopUntilAnimationsDone();
1455 CheckAllItemsAreInBounds(); 1455 CheckAllItemsAreInBounds();
1456 } 1456 }
1457 1457
1458 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); 1458 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool());
1459 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, 1459 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest,
1460 testing::Bool()); 1460 testing::Bool());
1461 1461
1462 } // namespace test 1462 } // namespace test
1463 } // namespace ash 1463 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/shelf/shelf_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698