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

Side by Side Diff: chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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
OLDNEW
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 "gaia", 137 "gaia",
138 "foo@example.com", 138 "foo@example.com",
139 "gaia", 139 "gaia",
140 "", 140 "",
141 "full_name", 141 "full_name",
142 "given_name", 142 "given_name",
143 "locale", 143 "locale",
144 "http://picture.example.com/picture.jpg"); 144 "http://picture.example.com/picture.jpg");
145 145
146 base::ListValue args; 146 base::ListValue args;
147 args.Set(0, new base::FundamentalValue(kDefaultDialogHeight)); 147 args.Set(0, new base::Value(kDefaultDialogHeight));
148 handler()->HandleInitializedWithSize(&args); 148 handler()->HandleInitializedWithSize(&args);
149 EXPECT_EQ(2U, web_ui()->call_data().size()); 149 EXPECT_EQ(2U, web_ui()->call_data().size());
150 150
151 // When the primary account is ready, setUserImageURL happens before 151 // When the primary account is ready, setUserImageURL happens before
152 // clearFocus since the image URL is known before showing the dialog. 152 // clearFocus since the image URL is known before showing the dialog.
153 EXPECT_EQ("sync.confirmation.setUserImageURL", 153 EXPECT_EQ("sync.confirmation.setUserImageURL",
154 web_ui()->call_data()[0]->function_name()); 154 web_ui()->call_data()[0]->function_name());
155 EXPECT_TRUE( 155 EXPECT_TRUE(
156 web_ui()->call_data()[0]->arg1()->IsType(base::Value::Type::STRING)); 156 web_ui()->call_data()[0]->arg1()->IsType(base::Value::Type::STRING));
157 std::string passed_picture_url; 157 std::string passed_picture_url;
158 EXPECT_TRUE( 158 EXPECT_TRUE(
159 web_ui()->call_data()[0]->arg1()->GetAsString(&passed_picture_url)); 159 web_ui()->call_data()[0]->arg1()->GetAsString(&passed_picture_url));
160 160
161 EXPECT_EQ("sync.confirmation.clearFocus", 161 EXPECT_EQ("sync.confirmation.clearFocus",
162 web_ui()->call_data()[1]->function_name()); 162 web_ui()->call_data()[1]->function_name());
163 163
164 std::string original_picture_url = 164 std::string original_picture_url =
165 AccountTrackerServiceFactory::GetForProfile(profile())-> 165 AccountTrackerServiceFactory::GetForProfile(profile())->
166 GetAccountInfo("gaia").picture_url; 166 GetAccountInfo("gaia").picture_url;
167 GURL picture_url_with_size; 167 GURL picture_url_with_size;
168 EXPECT_TRUE(profiles::GetImageURLWithThumbnailSize(GURL(original_picture_url), 168 EXPECT_TRUE(profiles::GetImageURLWithThumbnailSize(GURL(original_picture_url),
169 kExpectedProfileImageSize, 169 kExpectedProfileImageSize,
170 &picture_url_with_size)); 170 &picture_url_with_size));
171 EXPECT_EQ(picture_url_with_size.spec(), passed_picture_url); 171 EXPECT_EQ(picture_url_with_size.spec(), passed_picture_url);
172 } 172 }
173 173
174 TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReadyLater) { 174 TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReadyLater) {
175 base::ListValue args; 175 base::ListValue args;
176 args.Set(0, new base::FundamentalValue(kDefaultDialogHeight)); 176 args.Set(0, new base::Value(kDefaultDialogHeight));
177 handler()->HandleInitializedWithSize(&args); 177 handler()->HandleInitializedWithSize(&args);
178 EXPECT_EQ(2U, web_ui()->call_data().size()); 178 EXPECT_EQ(2U, web_ui()->call_data().size());
179 179
180 account_fetcher_service()->FakeUserInfoFetchSuccess( 180 account_fetcher_service()->FakeUserInfoFetchSuccess(
181 "gaia", 181 "gaia",
182 "foo@example.com", 182 "foo@example.com",
183 "gaia", 183 "gaia",
184 "", 184 "",
185 "full_name", 185 "full_name",
186 "given_name", 186 "given_name",
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 GURL picture_url_with_size; 218 GURL picture_url_with_size;
219 EXPECT_TRUE(profiles::GetImageURLWithThumbnailSize(GURL(original_picture_url), 219 EXPECT_TRUE(profiles::GetImageURLWithThumbnailSize(GURL(original_picture_url),
220 kExpectedProfileImageSize, 220 kExpectedProfileImageSize,
221 &picture_url_with_size)); 221 &picture_url_with_size));
222 EXPECT_EQ(picture_url_with_size.spec(), passed_picture_url); 222 EXPECT_EQ(picture_url_with_size.spec(), passed_picture_url);
223 } 223 }
224 224
225 TEST_F(SyncConfirmationHandlerTest, 225 TEST_F(SyncConfirmationHandlerTest,
226 TestSetImageIgnoredIfSecondaryAccountUpdated) { 226 TestSetImageIgnoredIfSecondaryAccountUpdated) {
227 base::ListValue args; 227 base::ListValue args;
228 args.Set(0, new base::FundamentalValue(kDefaultDialogHeight)); 228 args.Set(0, new base::Value(kDefaultDialogHeight));
229 handler()->HandleInitializedWithSize(&args); 229 handler()->HandleInitializedWithSize(&args);
230 EXPECT_EQ(2U, web_ui()->call_data().size()); 230 EXPECT_EQ(2U, web_ui()->call_data().size());
231 231
232 AccountTrackerServiceFactory::GetForProfile(profile())->SeedAccountInfo( 232 AccountTrackerServiceFactory::GetForProfile(profile())->SeedAccountInfo(
233 "bar_gaia", "bar@example.com"); 233 "bar_gaia", "bar@example.com");
234 account_fetcher_service()->FakeUserInfoFetchSuccess( 234 account_fetcher_service()->FakeUserInfoFetchSuccess(
235 "bar_gaia", "bar@example.com", "bar_gaia", "", "bar_full_name", 235 "bar_gaia", "bar@example.com", "bar_gaia", "", "bar_full_name",
236 "bar_given_name", "bar_locale", 236 "bar_given_name", "bar_locale",
237 "http://picture.example.com/bar_picture.jpg"); 237 "http://picture.example.com/bar_picture.jpg");
238 238
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 EXPECT_FALSE(sync()->IsFirstSetupInProgress()); 279 EXPECT_FALSE(sync()->IsFirstSetupInProgress());
280 EXPECT_TRUE(sync()->IsFirstSetupComplete()); 280 EXPECT_TRUE(sync()->IsFirstSetupComplete());
281 EXPECT_TRUE( 281 EXPECT_TRUE(
282 SigninManagerFactory::GetForProfile(profile())->IsAuthenticated()); 282 SigninManagerFactory::GetForProfile(profile())->IsAuthenticated());
283 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Undo_Signin")); 283 EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Undo_Signin"));
284 EXPECT_EQ(1, user_action_tester()->GetActionCount( 284 EXPECT_EQ(1, user_action_tester()->GetActionCount(
285 "Signin_Signin_WithDefaultSyncSettings")); 285 "Signin_Signin_WithDefaultSyncSettings"));
286 EXPECT_EQ(0, user_action_tester()->GetActionCount( 286 EXPECT_EQ(0, user_action_tester()->GetActionCount(
287 "Signin_Signin_WithAdvancedSyncSettings")); 287 "Signin_Signin_WithAdvancedSyncSettings"));
288 } 288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698