OLD | NEW |
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 "ui/app_list/views/app_list_main_view.h" | 5 #include "ui/app_list/views/app_list_main_view.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 class AppListMainViewTest : public views::ViewsTestBase { | 63 class AppListMainViewTest : public views::ViewsTestBase { |
64 public: | 64 public: |
65 AppListMainViewTest() | 65 AppListMainViewTest() |
66 : widget_(NULL), | 66 : widget_(NULL), |
67 main_view_(NULL) {} | 67 main_view_(NULL) {} |
68 | 68 |
69 virtual ~AppListMainViewTest() {} | 69 virtual ~AppListMainViewTest() {} |
70 | 70 |
71 // testing::Test overrides: | 71 // testing::Test overrides: |
72 virtual void SetUp() OVERRIDE { | 72 virtual void SetUp() override { |
73 views::ViewsTestBase::SetUp(); | 73 views::ViewsTestBase::SetUp(); |
74 delegate_.reset(new AppListTestViewDelegate); | 74 delegate_.reset(new AppListTestViewDelegate); |
75 | 75 |
76 // In Ash, the third argument is a container aura::Window, but it is always | 76 // In Ash, the third argument is a container aura::Window, but it is always |
77 // NULL on Windows, and not needed for tests. It is only used to determine | 77 // NULL on Windows, and not needed for tests. It is only used to determine |
78 // the scale factor for preloading icons. | 78 // the scale factor for preloading icons. |
79 main_view_ = new AppListMainView(delegate_.get(), 0, NULL); | 79 main_view_ = new AppListMainView(delegate_.get(), 0, NULL); |
80 main_view_->SetPaintToLayer(true); | 80 main_view_->SetPaintToLayer(true); |
81 main_view_->model()->SetFoldersEnabled(true); | 81 main_view_->model()->SetFoldersEnabled(true); |
82 | 82 |
83 widget_ = new views::Widget; | 83 widget_ = new views::Widget; |
84 views::Widget::InitParams params = | 84 views::Widget::InitParams params = |
85 CreateParams(views::Widget::InitParams::TYPE_POPUP); | 85 CreateParams(views::Widget::InitParams::TYPE_POPUP); |
86 params.bounds.set_size(main_view_->GetPreferredSize()); | 86 params.bounds.set_size(main_view_->GetPreferredSize()); |
87 widget_->Init(params); | 87 widget_->Init(params); |
88 | 88 |
89 widget_->SetContentsView(main_view_); | 89 widget_->SetContentsView(main_view_); |
90 } | 90 } |
91 | 91 |
92 virtual void TearDown() OVERRIDE { | 92 virtual void TearDown() override { |
93 widget_->Close(); | 93 widget_->Close(); |
94 views::ViewsTestBase::TearDown(); | 94 views::ViewsTestBase::TearDown(); |
95 delegate_.reset(); | 95 delegate_.reset(); |
96 } | 96 } |
97 | 97 |
98 // |point| is in |grid_view|'s coordinates. | 98 // |point| is in |grid_view|'s coordinates. |
99 AppListItemView* GetItemViewAtPointInGrid(AppsGridView* grid_view, | 99 AppListItemView* GetItemViewAtPointInGrid(AppsGridView* grid_view, |
100 const gfx::Point& point) { | 100 const gfx::Point& point) { |
101 const views::ViewModelT<AppListItemView>* view_model = | 101 const views::ViewModelT<AppListItemView>* view_model = |
102 grid_view->view_model_for_test(); | 102 grid_view->view_model_for_test(); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 // Additional mouse move operations should be ignored. | 333 // Additional mouse move operations should be ignored. |
334 gfx::Point point(1, 1); | 334 gfx::Point point(1, 1); |
335 SimulateUpdateDrag(FolderGridView(), AppsGridView::MOUSE, dragged, point); | 335 SimulateUpdateDrag(FolderGridView(), AppsGridView::MOUSE, dragged, point); |
336 EXPECT_FALSE(RootGridView()->has_dragged_view()); | 336 EXPECT_FALSE(RootGridView()->has_dragged_view()); |
337 EXPECT_FALSE(FolderGridView()->has_dragged_view()); | 337 EXPECT_FALSE(FolderGridView()->has_dragged_view()); |
338 } | 338 } |
339 | 339 |
340 } // namespace test | 340 } // namespace test |
341 } // namespace app_list | 341 } // namespace app_list |
OLD | NEW |