| 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())->
|
|
|