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 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #import "testing/gtest_mac.h" | 7 #import "testing/gtest_mac.h" |
8 #import "ui/app_list/cocoa/app_list_view_controller.h" | 8 #import "ui/app_list/cocoa/app_list_view_controller.h" |
9 #import "ui/app_list/cocoa/apps_grid_controller.h" | 9 #import "ui/app_list/cocoa/apps_grid_controller.h" |
10 #import "ui/app_list/cocoa/test/apps_grid_controller_test_helper.h" | 10 #import "ui/app_list/cocoa/test/apps_grid_controller_test_helper.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 void ReplaceTestModel(int item_count) { | 35 void ReplaceTestModel(int item_count) { |
36 [app_list_view_controller_ setDelegate:NULL]; | 36 [app_list_view_controller_ setDelegate:NULL]; |
37 delegate_.reset(new AppListTestViewDelegate); | 37 delegate_.reset(new AppListTestViewDelegate); |
38 delegate_->ReplaceTestModel(item_count); | 38 delegate_->ReplaceTestModel(item_count); |
39 [app_list_view_controller_ setDelegate:delegate_.get()]; | 39 [app_list_view_controller_ setDelegate:delegate_.get()]; |
40 } | 40 } |
41 | 41 |
42 AppListTestModel* model() { return delegate_->GetTestModel(); } | 42 AppListTestModel* model() { return delegate_->GetTestModel(); } |
43 | 43 |
44 protected: | 44 protected: |
45 scoped_ptr<AppListTestViewDelegate> delegate_; | 45 std::unique_ptr<AppListTestViewDelegate> delegate_; |
46 base::scoped_nsobject<AppListViewController> app_list_view_controller_; | 46 base::scoped_nsobject<AppListViewController> app_list_view_controller_; |
47 | 47 |
48 private: | 48 private: |
49 DISALLOW_COPY_AND_ASSIGN(AppListViewControllerTest); | 49 DISALLOW_COPY_AND_ASSIGN(AppListViewControllerTest); |
50 }; | 50 }; |
51 | 51 |
52 TEST_VIEW(AppListViewControllerTest, [app_list_view_controller_ view]); | 52 TEST_VIEW(AppListViewControllerTest, [app_list_view_controller_ view]); |
53 | 53 |
54 // Test that adding and removing pages updates the pager. | 54 // Test that adding and removing pages updates the pager. |
55 TEST_F(AppListViewControllerTest, PagerSegmentCounts) { | 55 TEST_F(AppListViewControllerTest, PagerSegmentCounts) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Replace with a single page model, and ensure we go back to the first page. | 89 // Replace with a single page model, and ensure we go back to the first page. |
90 ReplaceTestModel(1); | 90 ReplaceTestModel(1); |
91 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]); | 91 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]); |
92 EXPECT_EQ(0, [pager selectedSegment]); | 92 EXPECT_EQ(0, [pager selectedSegment]); |
93 EXPECT_EQ(1, [pager segmentCount]); | 93 EXPECT_EQ(1, [pager segmentCount]); |
94 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:0]); | 94 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:0]); |
95 } | 95 } |
96 | 96 |
97 } // namespace test | 97 } // namespace test |
98 } // namespace app_list | 98 } // namespace app_list |
OLD | NEW |