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

Unified Diff: chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc

Issue 1949613003: Clear initial focus in Sync Confirmation dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/signin/sync_confirmation_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
index abc61299dfba16529591ee34ef5f193a7805fbb5..0e633b32d5a0a1a758f7c4d3d0a0458209f0b79d 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
@@ -143,7 +143,10 @@ TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReady) {
base::ListValue args;
args.Set(0, new base::FundamentalValue(kDefaultDialogHeight));
handler()->HandleInitializedWithSize(&args);
- EXPECT_EQ(1U, web_ui()->call_data().size());
+ EXPECT_EQ(2U, web_ui()->call_data().size());
+
+ // When the primary account is ready, setUserImageURL happens before
+ // clearFocus since the image URL is known before showing the dialog.
EXPECT_EQ("sync.confirmation.setUserImageURL",
web_ui()->call_data()[0]->function_name());
EXPECT_TRUE(
@@ -152,6 +155,9 @@ TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReady) {
EXPECT_TRUE(
web_ui()->call_data()[0]->arg1()->GetAsString(&passed_picture_url));
+ EXPECT_EQ("sync.confirmation.clearFocus",
+ web_ui()->call_data()[1]->function_name());
+
std::string original_picture_url =
AccountTrackerServiceFactory::GetForProfile(profile())->
GetAccountInfo("gaia").picture_url;
@@ -169,7 +175,7 @@ TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReadyLater) {
base::ListValue args;
args.Set(0, new base::FundamentalValue(kDefaultDialogHeight));
handler()->HandleInitializedWithSize(&args);
- EXPECT_EQ(0U, web_ui()->call_data().size());
+ EXPECT_EQ(1U, web_ui()->call_data().size());
account_fetcher_service()->FakeUserInfoFetchSuccess(
"gaia",
@@ -181,14 +187,20 @@ TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReadyLater) {
"locale",
"http://picture.example.com/picture.jpg");
- EXPECT_EQ(1U, web_ui()->call_data().size());
- EXPECT_EQ("sync.confirmation.setUserImageURL",
+ EXPECT_EQ(2U, web_ui()->call_data().size());
+
+ // When the primary account isn't yet ready when the dialog is shown,
+ // clearFocus is called before setUserImageURL.
+ EXPECT_EQ("sync.confirmation.clearFocus",
web_ui()->call_data()[0]->function_name());
+
+ EXPECT_EQ("sync.confirmation.setUserImageURL",
+ web_ui()->call_data()[1]->function_name());
EXPECT_TRUE(
- web_ui()->call_data()[0]->arg1()->IsType(base::Value::TYPE_STRING));
+ web_ui()->call_data()[1]->arg1()->IsType(base::Value::TYPE_STRING));
std::string passed_picture_url;
EXPECT_TRUE(
- web_ui()->call_data()[0]->arg1()->GetAsString(&passed_picture_url));
+ web_ui()->call_data()[1]->arg1()->GetAsString(&passed_picture_url));
std::string original_picture_url =
AccountTrackerServiceFactory::GetForProfile(profile())->
« no previous file with comments | « chrome/browser/ui/webui/signin/sync_confirmation_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698