Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: ui/app_list/cocoa/app_list_view_controller_unittest.mm

Issue 309443002: Remove need to sign in to use the App Launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 scoped_ptr<AppListTestViewDelegate> delegate(new AppListTestViewDelegate); 22 scoped_ptr<AppListTestViewDelegate> delegate(new AppListTestViewDelegate);
23 delegate->SetSignedIn(true);
24 [app_list_view_controller_ 23 [app_list_view_controller_
25 setDelegate:delegate.PassAs<app_list::AppListViewDelegate>()]; 24 setDelegate:delegate.PassAs<app_list::AppListViewDelegate>()];
26 SetUpWithGridController([app_list_view_controller_ appsGridController]); 25 SetUpWithGridController([app_list_view_controller_ appsGridController]);
27 [[test_window() contentView] addSubview:[app_list_view_controller_ view]]; 26 [[test_window() contentView] addSubview:[app_list_view_controller_ view]];
28 } 27 }
29 28
30 virtual void TearDown() OVERRIDE { 29 virtual void TearDown() OVERRIDE {
31 [app_list_view_controller_ 30 [app_list_view_controller_
32 setDelegate:scoped_ptr<app_list::AppListViewDelegate>()]; 31 setDelegate:scoped_ptr<app_list::AppListViewDelegate>()];
33 app_list_view_controller_.reset(); 32 app_list_view_controller_.reset();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:1]); 96 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:1]);
98 97
99 // Replace with a single page model, and ensure we go back to the first page. 98 // Replace with a single page model, and ensure we go back to the first page.
100 ReplaceTestModel(1); 99 ReplaceTestModel(1);
101 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]); 100 EXPECT_EQ(0u, [apps_grid_controller_ visiblePage]);
102 EXPECT_EQ(0, [pager selectedSegment]); 101 EXPECT_EQ(0, [pager selectedSegment]);
103 EXPECT_EQ(1, [pager segmentCount]); 102 EXPECT_EQ(1, [pager segmentCount]);
104 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:0]); 103 EXPECT_EQ(1.0, [apps_grid_controller_ visiblePortionOfPage:0]);
105 } 104 }
106 105
107 // Test the view when the user is already signed in.
108 TEST_F(AppListViewControllerTest, SignedIn) {
109 // There should be just 1, visible subview when signed in.
110 EXPECT_EQ(1u, [[[app_list_view_controller_ view] subviews] count]);
111 EXPECT_FALSE([[app_list_view_controller_ backgroundView] isHidden]);
112 }
113
114 // Test the view when signin is required.
115 TEST_F(AppListViewControllerTest, NeedsSignin) {
116 // Begin the test with a signed out app list.
117 delegate()->SetSignedIn(false);
118 EXPECT_EQ(2u, [[[app_list_view_controller_ view] subviews] count]);
119 EXPECT_TRUE([[app_list_view_controller_ backgroundView] isHidden]);
120
121 // Simulate signing in, should enter the SignedIn state.
122 delegate()->SetSignedIn(true);
123 EXPECT_EQ(1u, [[[app_list_view_controller_ view] subviews] count]);
124 EXPECT_FALSE([[app_list_view_controller_ backgroundView] isHidden]);
125 }
126
127 } // namespace test 106 } // namespace test
128 } // namespace app_list 107 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698