| 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 "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/app_list/pagination_model.h" | 8 #include "ui/app_list/pagination_model.h" |
| 9 #include "ui/app_list/test/app_list_test_model.h" | 9 #include "ui/app_list/test/app_list_test_model.h" |
| 10 #include "ui/app_list/test/app_list_test_view_delegate.h" | 10 #include "ui/app_list/test/app_list_test_view_delegate.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 main_view_(NULL) {} | 29 main_view_(NULL) {} |
| 30 | 30 |
| 31 virtual ~AppListMainViewTest() {} | 31 virtual ~AppListMainViewTest() {} |
| 32 | 32 |
| 33 // testing::Test overrides: | 33 // testing::Test overrides: |
| 34 virtual void SetUp() OVERRIDE { | 34 virtual void SetUp() OVERRIDE { |
| 35 views::ViewsTestBase::SetUp(); | 35 views::ViewsTestBase::SetUp(); |
| 36 delegate_.reset(new AppListTestViewDelegate); | 36 delegate_.reset(new AppListTestViewDelegate); |
| 37 delegate_->GetTestModel()->PopulateApps(kInitialItems); | 37 delegate_->GetTestModel()->PopulateApps(kInitialItems); |
| 38 | 38 |
| 39 main_view_ = | 39 main_view_ = new AppListMainView(NULL, |
| 40 new AppListMainView(delegate_.get(), &pagination_model_, GetContext()); | 40 delegate_.get(), |
| 41 &pagination_model_, |
| 42 GetContext()); |
| 41 main_view_->SetPaintToLayer(true); | 43 main_view_->SetPaintToLayer(true); |
| 42 | 44 |
| 43 widget_ = new views::Widget; | 45 widget_ = new views::Widget; |
| 44 views::Widget::InitParams params = | 46 views::Widget::InitParams params = |
| 45 CreateParams(views::Widget::InitParams::TYPE_POPUP); | 47 CreateParams(views::Widget::InitParams::TYPE_POPUP); |
| 46 params.bounds.set_size(main_view_->GetPreferredSize()); | 48 params.bounds.set_size(main_view_->GetPreferredSize()); |
| 47 widget_->Init(params); | 49 widget_->Init(params); |
| 48 | 50 |
| 49 widget_->SetContentsView(main_view_); | 51 widget_->SetContentsView(main_view_); |
| 50 } | 52 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 81 scoped_ptr<AppListModel> old_model(delegate_->ReleaseTestModel()); | 83 scoped_ptr<AppListModel> old_model(delegate_->ReleaseTestModel()); |
| 82 | 84 |
| 83 const int kReplacementItems = 5; | 85 const int kReplacementItems = 5; |
| 84 delegate_->ReplaceTestModel(kReplacementItems); | 86 delegate_->ReplaceTestModel(kReplacementItems); |
| 85 main_view_->ModelChanged(); | 87 main_view_->ModelChanged(); |
| 86 EXPECT_EQ(kReplacementItems, ViewModel()->view_size()); | 88 EXPECT_EQ(kReplacementItems, ViewModel()->view_size()); |
| 87 } | 89 } |
| 88 | 90 |
| 89 } // namespace test | 91 } // namespace test |
| 90 } // namespace app_list | 92 } // namespace app_list |
| OLD | NEW |