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