| 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 "base/mac/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #import "testing/gtest_mac.h" | 6 #import "testing/gtest_mac.h" |
| 7 #import "ui/app_list/cocoa/app_list_view_controller.h" | 7 #import "ui/app_list/cocoa/app_list_view_controller.h" |
| 8 #import "ui/app_list/cocoa/apps_grid_controller.h" | 8 #import "ui/app_list/cocoa/apps_grid_controller.h" |
| 9 #import "ui/app_list/cocoa/test/apps_grid_controller_test_helper.h" | 9 #import "ui/app_list/cocoa/test/apps_grid_controller_test_helper.h" |
| 10 #include "ui/app_list/test/app_list_test_model.h" | 10 #include "ui/app_list/test/app_list_test_model.h" |
| 11 #include "ui/app_list/test/app_list_test_view_delegate.h" | 11 #include "ui/app_list/test/app_list_test_view_delegate.h" |
| 12 | 12 |
| 13 namespace app_list { | 13 namespace app_list { |
| 14 namespace test { | 14 namespace test { |
| 15 | 15 |
| 16 class AppListViewControllerTest : public AppsGridControllerTestHelper { | 16 class AppListViewControllerTest : public AppsGridControllerTestHelper { |
| 17 public: | 17 public: |
| 18 AppListViewControllerTest() {} | 18 AppListViewControllerTest() {} |
| 19 | 19 |
| 20 virtual void SetUp() OVERRIDE { | 20 virtual void SetUp() OVERRIDE { |
| 21 app_list_view_controller_.reset([[AppListViewController alloc] init]); | 21 app_list_view_controller_.reset([[AppListViewController alloc] init]); |
| 22 SetUpWithGridController([app_list_view_controller_ appsGridController]); | 22 SetUpWithGridController([app_list_view_controller_ appsGridController]); |
| 23 [[test_window() contentView] addSubview:[app_list_view_controller_ view]]; | 23 [[test_window() contentView] addSubview:[app_list_view_controller_ view]]; |
| 24 } | 24 } |
| 25 | 25 |
| 26 virtual void TearDown() OVERRIDE { | 26 virtual void TearDown() OVERRIDE { |
| 27 [app_list_view_controller_ | 27 [app_list_view_controller_ |
| 28 setDelegate:scoped_ptr<app_list::AppListViewDelegate>(NULL)]; | 28 setDelegate:scoped_ptr<app_list::AppListViewDelegate>()]; |
| 29 app_list_view_controller_.reset(); | 29 app_list_view_controller_.reset(); |
| 30 AppsGridControllerTestHelper::TearDown(); | 30 AppsGridControllerTestHelper::TearDown(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual void ResetModel(scoped_ptr<AppListModel> new_model) OVERRIDE { | 33 virtual void ResetModel(scoped_ptr<AppListModel> new_model) OVERRIDE { |
| 34 scoped_ptr<AppListViewDelegate> delegate_(new AppListTestViewDelegate); | 34 scoped_ptr<AppListViewDelegate> delegate_(new AppListTestViewDelegate); |
| 35 [app_list_view_controller_ setDelegate:delegate_.Pass() | 35 [app_list_view_controller_ setDelegate:delegate_.Pass() |
| 36 withTestModel:new_model.Pass()]; | 36 withTestModel:new_model.Pass()]; |
| 37 } | 37 } |
| 38 | 38 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // Replace with a single page model, and ensure we go back to the first page. | 83 // Replace with a single page model, and ensure we go back to the first page. |
| 84 ReplaceTestModel(1); | 84 ReplaceTestModel(1); |
| 85 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]); | 85 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]); |
| 86 EXPECT_EQ(0, [pager selectedSegment]); | 86 EXPECT_EQ(0, [pager selectedSegment]); |
| 87 EXPECT_EQ(1, [pager segmentCount]); | 87 EXPECT_EQ(1, [pager segmentCount]); |
| 88 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:0]); | 88 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:0]); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace test | 91 } // namespace test |
| 92 } // namespace app_list | 92 } // namespace app_list |
| OLD | NEW |