Commit a47474ce authored by Jared Saul's avatar Jared Saul Committed by Commit Bot

[AF] Add browsertests for Butter (i) info icon

This is a followup CL to add tests for
https://chromium-review.googlesource.com/c/chromium/src/+/1676674
which is being requested for merge.

Bug: 978514
Change-Id: Id6b8bc88454f27f9e1ca584f27b4e04e3894f325
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1676831
Commit-Queue: Jared Saul <jsaul@google.com>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686171}
parent 36c77e65
...@@ -51,6 +51,7 @@ enum DialogViewId : int { ...@@ -51,6 +51,7 @@ enum DialogViewId : int {
// The following are views::TooltipIcon objects. // The following are views::TooltipIcon objects.
CARDHOLDER_NAME_TOOLTIP, // Appears during cardholder name entry/confirmation CARDHOLDER_NAME_TOOLTIP, // Appears during cardholder name entry/confirmation
UPLOAD_EXPLANATION_TOOLTIP, // Appears for implicitly-syncing upload saves
// The following are views::Combobox objects. // The following are views::Combobox objects.
EXPIRATION_DATE_DROPBOX_MONTH, EXPIRATION_DATE_DROPBOX_MONTH,
......
...@@ -1296,6 +1296,21 @@ class SaveCardBubbleViewsSyncTransportFullFormBrowserTest ...@@ -1296,6 +1296,21 @@ class SaveCardBubbleViewsSyncTransportFullFormBrowserTest
SaveCardBubbleViewsFullFormBrowserTest::SetUpInProcessBrowserTestFixture(); SaveCardBubbleViewsFullFormBrowserTest::SetUpInProcessBrowserTestFixture();
} }
void SetUpForSyncTransportModeTest() {
// Signing in (without making the account Chrome's primary one or explicitly
// setting up Sync) causes the Sync machinery to start up in standalone
// transport mode.
secondary_account_helper::SignInSecondaryAccount(
browser()->profile(), test_url_loader_factory(), "user@gmail.com");
ASSERT_NE(syncer::SyncService::TransportState::DISABLED,
harness_->service()->GetTransportState());
ASSERT_TRUE(harness_->AwaitSyncTransportActive());
ASSERT_EQ(syncer::SyncService::TransportState::ACTIVE,
harness_->service()->GetTransportState());
ASSERT_FALSE(harness_->service()->IsSyncFeatureEnabled());
}
private: private:
secondary_account_helper::ScopedSigninClientFactory secondary_account_helper::ScopedSigninClientFactory
test_signin_client_factory_; test_signin_client_factory_;
...@@ -1308,19 +1323,7 @@ class SaveCardBubbleViewsSyncTransportFullFormBrowserTest ...@@ -1308,19 +1323,7 @@ class SaveCardBubbleViewsSyncTransportFullFormBrowserTest
// to Google Payments. // to Google Payments.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsSyncTransportFullFormBrowserTest, IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsSyncTransportFullFormBrowserTest,
Upload_TransportMode_ClickingSaveClosesBubble) { Upload_TransportMode_ClickingSaveClosesBubble) {
// Signing in (without making the account Chrome's primary one or explicitly SetUpForSyncTransportModeTest();
// setting up Sync) causes the Sync machinery to start up in standalone
// transport mode.
secondary_account_helper::SignInSecondaryAccount(
browser()->profile(), test_url_loader_factory(), "user@gmail.com");
ASSERT_NE(syncer::SyncService::TransportState::DISABLED,
harness_->service()->GetTransportState());
ASSERT_TRUE(harness_->AwaitSyncTransportActive());
ASSERT_EQ(syncer::SyncService::TransportState::ACTIVE,
harness_->service()->GetTransportState());
ASSERT_FALSE(harness_->service()->IsSyncFeatureEnabled());
FillForm(); FillForm();
SubmitFormAndWaitForCardUploadSaveBubble(); SubmitFormAndWaitForCardUploadSaveBubble();
...@@ -1335,6 +1338,42 @@ IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsSyncTransportFullFormBrowserTest, ...@@ -1335,6 +1338,42 @@ IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsSyncTransportFullFormBrowserTest,
AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1); AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1);
} }
// Tests the implicit sync state. Ensures that the (i) info icon appears for
// upload save offers.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsSyncTransportFullFormBrowserTest,
Upload_TransportMode_InfoTextIconExists) {
SetUpForSyncTransportModeTest();
FillForm();
SubmitFormAndWaitForCardUploadSaveBubble();
// As this is an upload save for a Butter-enabled user, there should be a
// hoverable (i) icon in the extra view explaining the functionality.
EXPECT_TRUE(FindViewInBubbleById(DialogViewId::UPLOAD_EXPLANATION_TOOLTIP));
}
// Tests the implicit sync state. Ensures that the (i) info icon does not appear
// for local save offers.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsSyncTransportFullFormBrowserTest,
Local_TransportMode_InfoTextIconDoesNotExist) {
SetUpForSyncTransportModeTest();
FillForm();
// Declining upload save will fall back to local save.
SetUploadDetailsRpcPaymentsDeclines();
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE,
DialogEvent::OFFERED_LOCAL_SAVE});
SubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_LOCAL)
->GetVisible());
// Even though this is a Butter-enabled user, as this is a local save, there
// should NOT be a hoverable (i) icon in the extra view.
EXPECT_FALSE(FindViewInBubbleById(DialogViewId::UPLOAD_EXPLANATION_TOOLTIP));
}
// Sets up Chrome with Sync-the-transport mode enabled, with the Wallet datatype // Sets up Chrome with Sync-the-transport mode enabled, with the Wallet datatype
// as enabled type as well as editable cardholder name enabled. // as enabled type as well as editable cardholder name enabled.
class class
...@@ -1403,7 +1442,24 @@ IN_PROC_BROWSER_TEST_F( ...@@ -1403,7 +1442,24 @@ IN_PROC_BROWSER_TEST_F(
base::ASCIIToUTF16("John Smith")); base::ASCIIToUTF16("John Smith"));
} }
#endif #endif // !OS_CHROMEOS
// Tests the fully-syncing state. Ensures that the Butter (i) info icon does not
// appear for fully-syncing users.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest,
Upload_NotTransportMode_InfoTextIconDoesNotExist) {
scoped_feature_list_.InitAndEnableFeature(features::kAutofillUpstream);
// Start sync.
harness_->SetupSync();
FillForm();
SubmitFormAndWaitForCardUploadSaveBubble();
// Even though this is an upload save, as this is a fully-syncing user, there
// should NOT be a hoverable (i) icon in the extra view.
EXPECT_FALSE(FindViewInBubbleById(DialogViewId::UPLOAD_EXPLANATION_TOOLTIP));
}
#if defined(OS_WIN) || defined(OS_MACOSX) || \ #if defined(OS_WIN) || defined(OS_MACOSX) || \
(defined(OS_LINUX) && !defined(OS_CHROMEOS)) (defined(OS_LINUX) && !defined(OS_CHROMEOS))
......
...@@ -77,6 +77,7 @@ std::unique_ptr<views::View> SaveCardOfferBubbleViews::CreateExtraView() { ...@@ -77,6 +77,7 @@ std::unique_ptr<views::View> SaveCardOfferBubbleViews::CreateExtraView() {
upload_explanation_tooltip->set_bubble_width(kTooltipBubbleWidth); upload_explanation_tooltip->set_bubble_width(kTooltipBubbleWidth);
upload_explanation_tooltip->set_anchor_point_arrow( upload_explanation_tooltip->set_anchor_point_arrow(
views::BubbleBorder::Arrow::TOP_RIGHT); views::BubbleBorder::Arrow::TOP_RIGHT);
upload_explanation_tooltip->SetID(DialogViewId::UPLOAD_EXPLANATION_TOOLTIP);
return upload_explanation_tooltip; return upload_explanation_tooltip;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment