| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 base::ListValue args; | 153 base::ListValue args; |
| 154 args.Set(0, new base::FundamentalValue(kDefaultDialogHeight)); | 154 args.Set(0, new base::FundamentalValue(kDefaultDialogHeight)); |
| 155 handler()->HandleInitializedWithSize(&args); | 155 handler()->HandleInitializedWithSize(&args); |
| 156 EXPECT_EQ(2U, web_ui()->call_data().size()); | 156 EXPECT_EQ(2U, web_ui()->call_data().size()); |
| 157 | 157 |
| 158 // When the primary account is ready, setUserImageURL happens before | 158 // When the primary account is ready, setUserImageURL happens before |
| 159 // clearFocus since the image URL is known before showing the dialog. | 159 // clearFocus since the image URL is known before showing the dialog. |
| 160 EXPECT_EQ("sync.confirmation.setUserImageURL", | 160 EXPECT_EQ("sync.confirmation.setUserImageURL", |
| 161 web_ui()->call_data()[0]->function_name()); | 161 web_ui()->call_data()[0]->function_name()); |
| 162 EXPECT_TRUE( | 162 EXPECT_TRUE( |
| 163 web_ui()->call_data()[0]->arg1()->IsType(base::Value::TYPE_STRING)); | 163 web_ui()->call_data()[0]->arg1()->IsType(base::Value::Type::STRING)); |
| 164 std::string passed_picture_url; | 164 std::string passed_picture_url; |
| 165 EXPECT_TRUE( | 165 EXPECT_TRUE( |
| 166 web_ui()->call_data()[0]->arg1()->GetAsString(&passed_picture_url)); | 166 web_ui()->call_data()[0]->arg1()->GetAsString(&passed_picture_url)); |
| 167 | 167 |
| 168 EXPECT_EQ("sync.confirmation.clearFocus", | 168 EXPECT_EQ("sync.confirmation.clearFocus", |
| 169 web_ui()->call_data()[1]->function_name()); | 169 web_ui()->call_data()[1]->function_name()); |
| 170 | 170 |
| 171 std::string original_picture_url = | 171 std::string original_picture_url = |
| 172 AccountTrackerServiceFactory::GetForProfile(profile())-> | 172 AccountTrackerServiceFactory::GetForProfile(profile())-> |
| 173 GetAccountInfo("gaia").picture_url; | 173 GetAccountInfo("gaia").picture_url; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 197 EXPECT_EQ(2U, web_ui()->call_data().size()); | 197 EXPECT_EQ(2U, web_ui()->call_data().size()); |
| 198 | 198 |
| 199 // When the primary account isn't yet ready when the dialog is shown, | 199 // When the primary account isn't yet ready when the dialog is shown, |
| 200 // clearFocus is called before setUserImageURL. | 200 // clearFocus is called before setUserImageURL. |
| 201 EXPECT_EQ("sync.confirmation.clearFocus", | 201 EXPECT_EQ("sync.confirmation.clearFocus", |
| 202 web_ui()->call_data()[0]->function_name()); | 202 web_ui()->call_data()[0]->function_name()); |
| 203 | 203 |
| 204 EXPECT_EQ("sync.confirmation.setUserImageURL", | 204 EXPECT_EQ("sync.confirmation.setUserImageURL", |
| 205 web_ui()->call_data()[1]->function_name()); | 205 web_ui()->call_data()[1]->function_name()); |
| 206 EXPECT_TRUE( | 206 EXPECT_TRUE( |
| 207 web_ui()->call_data()[1]->arg1()->IsType(base::Value::TYPE_STRING)); | 207 web_ui()->call_data()[1]->arg1()->IsType(base::Value::Type::STRING)); |
| 208 std::string passed_picture_url; | 208 std::string passed_picture_url; |
| 209 EXPECT_TRUE( | 209 EXPECT_TRUE( |
| 210 web_ui()->call_data()[1]->arg1()->GetAsString(&passed_picture_url)); | 210 web_ui()->call_data()[1]->arg1()->GetAsString(&passed_picture_url)); |
| 211 | 211 |
| 212 std::string original_picture_url = | 212 std::string original_picture_url = |
| 213 AccountTrackerServiceFactory::GetForProfile(profile())-> | 213 AccountTrackerServiceFactory::GetForProfile(profile())-> |
| 214 GetAccountInfo("gaia").picture_url; | 214 GetAccountInfo("gaia").picture_url; |
| 215 GURL picture_url_with_size; | 215 GURL picture_url_with_size; |
| 216 EXPECT_TRUE(profiles::GetImageURLWithThumbnailSize(GURL(original_picture_url), | 216 EXPECT_TRUE(profiles::GetImageURLWithThumbnailSize(GURL(original_picture_url), |
| 217 kExpectedProfileImageSize, | 217 kExpectedProfileImageSize, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 247 EXPECT_FALSE(sync()->IsFirstSetupInProgress()); | 247 EXPECT_FALSE(sync()->IsFirstSetupInProgress()); |
| 248 EXPECT_TRUE(sync()->IsFirstSetupComplete()); | 248 EXPECT_TRUE(sync()->IsFirstSetupComplete()); |
| 249 EXPECT_TRUE( | 249 EXPECT_TRUE( |
| 250 SigninManagerFactory::GetForProfile(profile())->IsAuthenticated()); | 250 SigninManagerFactory::GetForProfile(profile())->IsAuthenticated()); |
| 251 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Undo_Signin")); | 251 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Undo_Signin")); |
| 252 EXPECT_EQ(1, user_action_tester()->GetActionCount( | 252 EXPECT_EQ(1, user_action_tester()->GetActionCount( |
| 253 "Signin_Signin_WithDefaultSyncSettings")); | 253 "Signin_Signin_WithDefaultSyncSettings")); |
| 254 EXPECT_EQ(0, user_action_tester()->GetActionCount( | 254 EXPECT_EQ(0, user_action_tester()->GetActionCount( |
| 255 "Signin_Signin_WithAdvancedSyncSettings")); | 255 "Signin_Signin_WithAdvancedSyncSettings")); |
| 256 } | 256 } |
| OLD | NEW |