| 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 delegate_.reset(new AppListTestViewDelegate); | 22 delegate_.reset(new AppListTestViewDelegate); |
| 23 [app_list_view_controller_ setDelegate:delegate_.get()]; | 23 [app_list_view_controller_ setDelegate:delegate_.get()]; |
| 24 SetUpWithGridController([app_list_view_controller_ appsGridController]); | 24 SetUpWithGridController([app_list_view_controller_ appsGridController]); |
| 25 [[test_window() contentView] addSubview:[app_list_view_controller_ view]]; | 25 [[test_window() contentView] addSubview:[app_list_view_controller_ view]]; |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual void TearDown() OVERRIDE { | 28 virtual void TearDown() override { |
| 29 [app_list_view_controller_ setDelegate:NULL]; | 29 [app_list_view_controller_ setDelegate:NULL]; |
| 30 app_list_view_controller_.reset(); | 30 app_list_view_controller_.reset(); |
| 31 AppsGridControllerTestHelper::TearDown(); | 31 AppsGridControllerTestHelper::TearDown(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ReplaceTestModel(int item_count) { | 34 void ReplaceTestModel(int item_count) { |
| 35 [app_list_view_controller_ setDelegate:NULL]; | 35 [app_list_view_controller_ setDelegate:NULL]; |
| 36 delegate_.reset(new AppListTestViewDelegate); | 36 delegate_.reset(new AppListTestViewDelegate); |
| 37 delegate_->ReplaceTestModel(item_count); | 37 delegate_->ReplaceTestModel(item_count); |
| 38 [app_list_view_controller_ setDelegate:delegate_.get()]; | 38 [app_list_view_controller_ setDelegate:delegate_.get()]; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // Replace with a single page model, and ensure we go back to the first page. | 88 // Replace with a single page model, and ensure we go back to the first page. |
| 89 ReplaceTestModel(1); | 89 ReplaceTestModel(1); |
| 90 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]); | 90 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]); |
| 91 EXPECT_EQ(0, [pager selectedSegment]); | 91 EXPECT_EQ(0, [pager selectedSegment]); |
| 92 EXPECT_EQ(1, [pager segmentCount]); | 92 EXPECT_EQ(1, [pager segmentCount]); |
| 93 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:0]); | 93 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:0]); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace test | 96 } // namespace test |
| 97 } // namespace app_list | 97 } // namespace app_list |
| OLD | NEW |