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/memory/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 |
(...skipping 14 matching lines...) Expand all Loading... |
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 |
39 protected: | 39 protected: |
40 scoped_nsobject<AppListViewController> app_list_view_controller_; | 40 base::scoped_nsobject<AppListViewController> app_list_view_controller_; |
41 | 41 |
42 private: | 42 private: |
43 DISALLOW_COPY_AND_ASSIGN(AppListViewControllerTest); | 43 DISALLOW_COPY_AND_ASSIGN(AppListViewControllerTest); |
44 }; | 44 }; |
45 | 45 |
46 TEST_VIEW(AppListViewControllerTest, [app_list_view_controller_ view]); | 46 TEST_VIEW(AppListViewControllerTest, [app_list_view_controller_ view]); |
47 | 47 |
48 // Test that adding and removing pages updates the pager. | 48 // Test that adding and removing pages updates the pager. |
49 TEST_F(AppListViewControllerTest, PagerSegmentCounts) { | 49 TEST_F(AppListViewControllerTest, PagerSegmentCounts) { |
50 NSSegmentedControl* pager = [app_list_view_controller_ pagerControl]; | 50 NSSegmentedControl* pager = [app_list_view_controller_ pagerControl]; |
(...skipping 32 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 |