| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/app_list/app_list_switches.h" | 15 #include "ui/app_list/app_list_switches.h" |
| 16 #include "ui/app_list/test/app_list_test_model.h" | 16 #include "ui/app_list/test/app_list_test_model.h" |
| 17 #include "ui/app_list/test/app_list_test_view_delegate.h" | 17 #include "ui/app_list/test/app_list_test_view_delegate.h" |
| 18 #include "ui/app_list/views/app_list_folder_view.h" | 18 #include "ui/app_list/views/app_list_folder_view.h" |
| 19 #include "ui/app_list/views/app_list_item_view.h" | 19 #include "ui/app_list/views/app_list_item_view.h" |
| 20 #include "ui/app_list/views/apps_container_view.h" | 20 #include "ui/app_list/views/apps_container_view.h" |
| 21 #include "ui/app_list/views/apps_grid_view.h" | 21 #include "ui/app_list/views/apps_grid_view.h" |
| 22 #include "ui/app_list/views/contents_view.h" | 22 #include "ui/app_list/views/contents_view.h" |
| 23 #include "ui/app_list/views/search_box_view.h" | 23 #include "ui/app_list/views/search_box_view.h" |
| 24 #include "ui/app_list/views/test/apps_grid_view_test_api.h" | 24 #include "ui/app_list/views/test/apps_grid_view_test_api.h" |
| 25 #include "ui/compositor/layer_type.h" |
| 25 #include "ui/events/event_utils.h" | 26 #include "ui/events/event_utils.h" |
| 26 #include "ui/events/test/event_generator.h" | 27 #include "ui/events/test/event_generator.h" |
| 27 #include "ui/views/test/views_test_base.h" | 28 #include "ui/views/test/views_test_base.h" |
| 28 #include "ui/views/view_model.h" | 29 #include "ui/views/view_model.h" |
| 29 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| 30 | 31 |
| 31 namespace app_list { | 32 namespace app_list { |
| 32 namespace test { | 33 namespace test { |
| 33 | 34 |
| 34 namespace { | 35 namespace { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 80 |
| 80 // testing::Test overrides: | 81 // testing::Test overrides: |
| 81 void SetUp() override { | 82 void SetUp() override { |
| 82 views::ViewsTestBase::SetUp(); | 83 views::ViewsTestBase::SetUp(); |
| 83 delegate_.reset(new AppListTestViewDelegate); | 84 delegate_.reset(new AppListTestViewDelegate); |
| 84 | 85 |
| 85 // In Ash, the third argument is a container aura::Window, but it is always | 86 // In Ash, the third argument is a container aura::Window, but it is always |
| 86 // NULL on Windows, and not needed for tests. It is only used to determine | 87 // NULL on Windows, and not needed for tests. It is only used to determine |
| 87 // the scale factor for preloading icons. | 88 // the scale factor for preloading icons. |
| 88 main_view_ = new AppListMainView(delegate_.get()); | 89 main_view_ = new AppListMainView(delegate_.get()); |
| 89 main_view_->SetPaintToLayer(true); | 90 main_view_->SetPaintToLayer(ui::LAYER_TEXTURED); |
| 90 main_view_->model()->SetFoldersEnabled(true); | 91 main_view_->model()->SetFoldersEnabled(true); |
| 91 search_box_view_ = new SearchBoxView(main_view_, delegate_.get()); | 92 search_box_view_ = new SearchBoxView(main_view_, delegate_.get()); |
| 92 main_view_->Init(nullptr, 0, search_box_view_); | 93 main_view_->Init(nullptr, 0, search_box_view_); |
| 93 | 94 |
| 94 main_widget_ = new views::Widget; | 95 main_widget_ = new views::Widget; |
| 95 views::Widget::InitParams main_widget_params = | 96 views::Widget::InitParams main_widget_params = |
| 96 CreateParams(views::Widget::InitParams::TYPE_POPUP); | 97 CreateParams(views::Widget::InitParams::TYPE_POPUP); |
| 97 main_widget_params.bounds.set_size(main_view_->GetPreferredSize()); | 98 main_widget_params.bounds.set_size(main_view_->GetPreferredSize()); |
| 98 main_widget_->Init(main_widget_params); | 99 main_widget_->Init(main_widget_params); |
| 99 main_widget_->SetContentsView(main_view_); | 100 main_widget_->SetContentsView(main_view_); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 // The app list model should remain unchanged. | 450 // The app list model should remain unchanged. |
| 450 EXPECT_EQ(1, FolderViewModel()->view_size()); | 451 EXPECT_EQ(1, FolderViewModel()->view_size()); |
| 451 EXPECT_EQ(2, RootViewModel()->view_size()); | 452 EXPECT_EQ(2, RootViewModel()->view_size()); |
| 452 EXPECT_EQ(folder_id, RootGridView()->GetItemViewAt(0)->item()->id()); | 453 EXPECT_EQ(folder_id, RootGridView()->GetItemViewAt(0)->item()->id()); |
| 453 EXPECT_NE(nullptr, | 454 EXPECT_NE(nullptr, |
| 454 delegate_->GetTestModel()->FindFolderItem("single_item_folder")); | 455 delegate_->GetTestModel()->FindFolderItem("single_item_folder")); |
| 455 } | 456 } |
| 456 | 457 |
| 457 } // namespace test | 458 } // namespace test |
| 458 } // namespace app_list | 459 } // namespace app_list |
| OLD | NEW |