| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 browser()->tab_strip_model()->GetActiveWebContents()); | 56 browser()->tab_strip_model()->GetActiveWebContents()); |
| 57 | 57 |
| 58 // WebUI owns the handlers. | 58 // WebUI owns the handlers. |
| 59 handler_ = new TestingSyncConfirmationHandler(web_ui()); | 59 handler_ = new TestingSyncConfirmationHandler(web_ui()); |
| 60 sync_confirmation_ui_.reset( | 60 sync_confirmation_ui_.reset( |
| 61 new SyncConfirmationUI(web_ui(), handler_)); | 61 new SyncConfirmationUI(web_ui(), handler_)); |
| 62 | 62 |
| 63 // This dialog assumes the signin flow was completed, which kicks off the | 63 // This dialog assumes the signin flow was completed, which kicks off the |
| 64 // SigninManager. | 64 // SigninManager. |
| 65 new OneClickSigninSyncStarter( | 65 new OneClickSigninSyncStarter( |
| 66 profile(), | 66 profile(), browser(), "gaia", "foo@example.com", "password", |
| 67 browser(), | 67 "refresh_token", OneClickSigninSyncStarter::CURRENT_PROFILE, |
| 68 "gaia", | 68 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, nullptr, |
| 69 "foo@example.com", | 69 OneClickSigninSyncStarter::NO_CONFIRMATION, GURL(), GURL(), |
| 70 "password", | |
| 71 "refresh_token", | |
| 72 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, | |
| 73 nullptr, | |
| 74 OneClickSigninSyncStarter::NO_CONFIRMATION, | |
| 75 GURL(), | |
| 76 GURL(), | |
| 77 OneClickSigninSyncStarter::Callback()); | 70 OneClickSigninSyncStarter::Callback()); |
| 78 } | 71 } |
| 79 | 72 |
| 80 void TearDown() override { | 73 void TearDown() override { |
| 81 sync_confirmation_ui_.reset(); | 74 sync_confirmation_ui_.reset(); |
| 82 web_ui_.reset(); | 75 web_ui_.reset(); |
| 83 BrowserWithTestWindowTest::TearDown(); | 76 BrowserWithTestWindowTest::TearDown(); |
| 84 | 77 |
| 85 if (did_user_explicitly_interact) { | 78 if (did_user_explicitly_interact) { |
| 86 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Abort_Signin")); | 79 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Abort_Signin")); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 EXPECT_FALSE(sync()->IsFirstSetupInProgress()); | 240 EXPECT_FALSE(sync()->IsFirstSetupInProgress()); |
| 248 EXPECT_TRUE(sync()->IsFirstSetupComplete()); | 241 EXPECT_TRUE(sync()->IsFirstSetupComplete()); |
| 249 EXPECT_TRUE( | 242 EXPECT_TRUE( |
| 250 SigninManagerFactory::GetForProfile(profile())->IsAuthenticated()); | 243 SigninManagerFactory::GetForProfile(profile())->IsAuthenticated()); |
| 251 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Undo_Signin")); | 244 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Undo_Signin")); |
| 252 EXPECT_EQ(1, user_action_tester()->GetActionCount( | 245 EXPECT_EQ(1, user_action_tester()->GetActionCount( |
| 253 "Signin_Signin_WithDefaultSyncSettings")); | 246 "Signin_Signin_WithDefaultSyncSettings")); |
| 254 EXPECT_EQ(0, user_action_tester()->GetActionCount( | 247 EXPECT_EQ(0, user_action_tester()->GetActionCount( |
| 255 "Signin_Signin_WithAdvancedSyncSettings")); | 248 "Signin_Signin_WithAdvancedSyncSettings")); |
| 256 } | 249 } |
| OLD | NEW |