OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" | 5 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" |
6 | 6 |
7 #include "base/test/user_action_tester.h" | 7 #include "base/test/user_action_tester.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 9 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
10 #include "chrome/browser/signin/account_fetcher_service_factory.h" | 10 #include "chrome/browser/signin/account_fetcher_service_factory.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 TestingProfile* CreateProfile() override { | 115 TestingProfile* CreateProfile() override { |
116 TestingProfile::Builder builder; | 116 TestingProfile::Builder builder; |
117 builder.AddTestingFactory(AccountFetcherServiceFactory::GetInstance(), | 117 builder.AddTestingFactory(AccountFetcherServiceFactory::GetInstance(), |
118 FakeAccountFetcherServiceBuilder::BuildForTests); | 118 FakeAccountFetcherServiceBuilder::BuildForTests); |
119 builder.AddTestingFactory( | 119 builder.AddTestingFactory( |
120 SigninManagerFactory::GetInstance(), BuildFakeSigninManagerBase); | 120 SigninManagerFactory::GetInstance(), BuildFakeSigninManagerBase); |
121 return builder.Build().release(); | 121 return builder.Build().release(); |
122 } | 122 } |
123 | 123 |
124 private: | 124 private: |
125 scoped_ptr<content::TestWebUI> web_ui_; | 125 std::unique_ptr<content::TestWebUI> web_ui_; |
126 scoped_ptr<SyncConfirmationUI> sync_confirmation_ui_; | 126 std::unique_ptr<SyncConfirmationUI> sync_confirmation_ui_; |
127 TestingSyncConfirmationHandler* handler_; // Not owned. | 127 TestingSyncConfirmationHandler* handler_; // Not owned. |
128 base::UserActionTester user_action_tester_; | 128 base::UserActionTester user_action_tester_; |
129 }; | 129 }; |
130 | 130 |
131 TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReady) { | 131 TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReady) { |
132 browser()->ShowModalSyncConfirmationWindow(); | 132 browser()->ShowModalSyncConfirmationWindow(); |
133 account_fetcher_service()->FakeUserInfoFetchSuccess( | 133 account_fetcher_service()->FakeUserInfoFetchSuccess( |
134 "gaia", | 134 "gaia", |
135 "foo@example.com", | 135 "foo@example.com", |
136 "gaia", | 136 "gaia", |
137 "", | 137 "", |
138 "full_name", | 138 "full_name", |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 EXPECT_FALSE(sync()->IsFirstSetupInProgress()); | 227 EXPECT_FALSE(sync()->IsFirstSetupInProgress()); |
228 EXPECT_TRUE(sync()->IsFirstSetupComplete()); | 228 EXPECT_TRUE(sync()->IsFirstSetupComplete()); |
229 EXPECT_TRUE( | 229 EXPECT_TRUE( |
230 SigninManagerFactory::GetForProfile(profile())->IsAuthenticated()); | 230 SigninManagerFactory::GetForProfile(profile())->IsAuthenticated()); |
231 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Undo_Signin")); | 231 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Undo_Signin")); |
232 EXPECT_EQ(1, user_action_tester()->GetActionCount( | 232 EXPECT_EQ(1, user_action_tester()->GetActionCount( |
233 "Signin_Signin_WithDefaultSyncSettings")); | 233 "Signin_Signin_WithDefaultSyncSettings")); |
234 EXPECT_EQ(0, user_action_tester()->GetActionCount( | 234 EXPECT_EQ(0, user_action_tester()->GetActionCount( |
235 "Signin_Signin_WithAdvancedSyncSettings")); | 235 "Signin_Signin_WithAdvancedSyncSettings")); |
236 } | 236 } |
OLD | NEW |