Commit 24ec90a3 authored by Asanka Herath's avatar Asanka Herath Committed by Commit Bot

Revert "[Autofill] Browser Tests for Sign-in After Local Save."

This reverts commit d54e0de4.

Reason for revert: Tests added in this CL are failing. See https://crbug.com/886533

Original change's description:
> [Autofill] Browser Tests for Sign-in After Local Save.
> 
> Adding browser tests for the sign-in after local save flow. This includes user-action sign-in metrics, the sign-in promo, and the manage cards prompt.
> 
> Bug: 855186
> Change-Id: I8c1d15f79e6915230860d7f0f2529a10c01559b7
> Reviewed-on: https://chromium-review.googlesource.com/1196918
> Commit-Queue: Manas Verma <manasverma@google.com>
> Reviewed-by: Evan Stade <estade@chromium.org>
> Reviewed-by: Mathieu Perreault <mathp@chromium.org>
> Reviewed-by: Jared Saul <jsaul@google.com>
> Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#592227}

TBR=mathp@chromium.org,estade@chromium.org,msarda@chromium.org,jsaul@google.com,manasverma@google.com

Change-Id: I6fe0b1508df0980aded5fa38fb5d43b3664db83f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 855186
Reviewed-on: https://chromium-review.googlesource.com/1233938Reviewed-by: default avatarAsanka Herath <asanka@chromium.org>
Commit-Queue: Asanka Herath <asanka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592397}
parent 2c72caa0
...@@ -555,10 +555,6 @@ void SaveCardBubbleControllerImpl::ShowBubble() { ...@@ -555,10 +555,6 @@ void SaveCardBubbleControllerImpl::ShowBubble() {
case BubbleType::INACTIVE: case BubbleType::INACTIVE:
NOTREACHED(); NOTREACHED();
} }
if (observer_for_testing_) {
observer_for_testing_->OnBubbleShown();
}
} }
void SaveCardBubbleControllerImpl::UpdateIcon() { void SaveCardBubbleControllerImpl::UpdateIcon() {
......
...@@ -31,13 +31,6 @@ class SaveCardBubbleControllerImpl ...@@ -31,13 +31,6 @@ class SaveCardBubbleControllerImpl
public content::WebContentsObserver, public content::WebContentsObserver,
public content::WebContentsUserData<SaveCardBubbleControllerImpl> { public content::WebContentsUserData<SaveCardBubbleControllerImpl> {
public: public:
// An observer class used by browsertests that gets notified whenever
// particular actions occur.
class ObserverForTest {
public:
virtual void OnBubbleShown() = 0;
};
~SaveCardBubbleControllerImpl() override; ~SaveCardBubbleControllerImpl() override;
// Sets up the controller for local save and shows the bubble. // Sets up the controller for local save and shows the bubble.
...@@ -130,7 +123,6 @@ class SaveCardBubbleControllerImpl ...@@ -130,7 +123,6 @@ class SaveCardBubbleControllerImpl
private: private:
friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>; friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>;
friend class SaveCardBubbleViewsBrowserTestBase;
void FetchAccountInfo(); void FetchAccountInfo();
...@@ -141,11 +133,6 @@ class SaveCardBubbleControllerImpl ...@@ -141,11 +133,6 @@ class SaveCardBubbleControllerImpl
void OpenUrl(const GURL& url); void OpenUrl(const GURL& url);
// For testing.
void SetEventObserverForTesting(ObserverForTest* observer) {
observer_for_testing_ = observer;
}
// The web_contents associated with this controller. // The web_contents associated with this controller.
content::WebContents* web_contents_; content::WebContents* web_contents_;
...@@ -203,9 +190,6 @@ class SaveCardBubbleControllerImpl ...@@ -203,9 +190,6 @@ class SaveCardBubbleControllerImpl
// The security level for the current context. // The security level for the current context.
security_state::SecurityLevel security_level_; security_state::SecurityLevel security_level_;
// Observer for when a bubble is created. Initialized only during tests.
ObserverForTest* observer_for_testing_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl); DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl);
}; };
......
...@@ -22,9 +22,6 @@ enum DialogViewId : int { ...@@ -22,9 +22,6 @@ enum DialogViewId : int {
SIGN_IN_PROMO_VIEW, // Contains the sign-in promo view SIGN_IN_PROMO_VIEW, // Contains the sign-in promo view
MANAGE_CARDS_VIEW, // The manage cards view MANAGE_CARDS_VIEW, // The manage cards view
// The sub-view that contains the sign-in button in the promo.
SIGN_IN_VIEW,
// The following are views::LabelButton objects (clickable). // The following are views::LabelButton objects (clickable).
OK_BUTTON, // Can say [Save], [Next], [Confirm], OK_BUTTON, // Can say [Save], [Next], [Confirm],
// or [Done] depending on context // or [Done] depending on context
......
...@@ -205,10 +205,9 @@ std::unique_ptr<views::View> SaveCardBubbleViews::CreateMainContentView() { ...@@ -205,10 +205,9 @@ std::unique_ptr<views::View> SaveCardBubbleViews::CreateMainContentView() {
return view; return view;
} }
void SaveCardBubbleViews::InitFootnoteView(views::View* footnote_view) { void SaveCardBubbleViews::SetFootnoteViewForTesting(
DCHECK(!footnote_view_); views::View* footnote_view) {
footnote_view_ = footnote_view; footnote_view_ = footnote_view;
footnote_view_->set_id(DialogViewId::FOOTNOTE_VIEW);
} }
void SaveCardBubbleViews::AssignIdsToDialogClientView() { void SaveCardBubbleViews::AssignIdsToDialogClientView() {
......
...@@ -83,8 +83,8 @@ class SaveCardBubbleViews : public SaveCardBubbleView, ...@@ -83,8 +83,8 @@ class SaveCardBubbleViews : public SaveCardBubbleView,
// footnote. // footnote.
virtual std::unique_ptr<views::View> CreateMainContentView(); virtual std::unique_ptr<views::View> CreateMainContentView();
// Called by sub-classes to initialize |footnote_view_|. // Set the footnote view so that its accessible for testing.
virtual void InitFootnoteView(views::View* footnote_view); void SetFootnoteViewForTesting(views::View* footnote_view);
SaveCardBubbleController* controller() { SaveCardBubbleController* controller() {
return controller_; return controller_;
...@@ -101,7 +101,11 @@ class SaveCardBubbleViews : public SaveCardBubbleView, ...@@ -101,7 +101,11 @@ class SaveCardBubbleViews : public SaveCardBubbleView,
~SaveCardBubbleViews() override; ~SaveCardBubbleViews() override;
private: private:
friend class SaveCardBubbleViewsBrowserTestBase; FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewsFullFormBrowserTest,
Upload_ClickingCloseClosesBubble);
FRIEND_TEST_ALL_PREFIXES(
SaveCardBubbleViewsFullFormBrowserTest,
Upload_DecliningUploadDoesNotLogUserAcceptedCardOriginUMA);
views::View* footnote_view_ = nullptr; views::View* footnote_view_ = nullptr;
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <list> #include <list>
#include <memory> #include <memory>
#include <string> #include <string>
#include <utility>
#include "chrome/browser/signin/account_fetcher_service_factory.h" #include "chrome/browser/signin/account_fetcher_service_factory.h"
#include "chrome/browser/signin/account_tracker_service_factory.h" #include "chrome/browser/signin/account_tracker_service_factory.h"
...@@ -17,13 +16,9 @@ ...@@ -17,13 +16,9 @@
#include "chrome/browser/ui/autofill/chrome_autofill_client.h" #include "chrome/browser/ui/autofill/chrome_autofill_client.h"
#include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/location_bar/location_bar.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/autofill/dialog_view_ids.h" #include "chrome/browser/ui/views/autofill/dialog_view_ids.h"
#include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h"
#include "chrome/browser/ui/views/autofill/save_card_icon_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/content/browser/content_autofill_driver.h"
#include "components/autofill/core/browser/credit_card_save_manager.h" #include "components/autofill/core/browser/credit_card_save_manager.h"
...@@ -139,11 +134,6 @@ void SaveCardBubbleViewsBrowserTestBase::OnSentUploadCardRequest() { ...@@ -139,11 +134,6 @@ void SaveCardBubbleViewsBrowserTestBase::OnSentUploadCardRequest() {
event_waiter_->OnEvent(DialogEvent::SENT_UPLOAD_CARD_REQUEST); event_waiter_->OnEvent(DialogEvent::SENT_UPLOAD_CARD_REQUEST);
} }
void SaveCardBubbleViewsBrowserTestBase::OnBubbleShown() {
if (event_waiter_)
event_waiter_->OnEvent(DialogEvent::BUBBLE_SHOWN);
}
void SaveCardBubbleViewsBrowserTestBase::SetUpInProcessBrowserTestFixture() { void SaveCardBubbleViewsBrowserTestBase::SetUpInProcessBrowserTestFixture() {
will_create_browser_context_services_subscription_ = will_create_browser_context_services_subscription_ =
BrowserContextDependencyManager::GetInstance() BrowserContextDependencyManager::GetInstance()
...@@ -346,18 +336,6 @@ void SaveCardBubbleViewsBrowserTestBase::SetUploadDetailsRpcServerError() { ...@@ -346,18 +336,6 @@ void SaveCardBubbleViewsBrowserTestBase::SetUploadDetailsRpcServerError() {
net::HTTP_INTERNAL_SERVER_ERROR); net::HTTP_INTERNAL_SERVER_ERROR);
} }
void SaveCardBubbleViewsBrowserTestBase::ClickOnView(views::View* view) {
DCHECK(view);
ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
ui::EF_LEFT_MOUSE_BUTTON);
view->OnMousePressed(pressed);
ui::MouseEvent released_event = ui::MouseEvent(
ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
view->OnMouseReleased(released_event);
}
void SaveCardBubbleViewsBrowserTestBase::ClickOnDialogView(views::View* view) { void SaveCardBubbleViewsBrowserTestBase::ClickOnDialogView(views::View* view) {
GetSaveCardBubbleViews() GetSaveCardBubbleViews()
->GetDialogClientView() ->GetDialogClientView()
...@@ -368,7 +346,16 @@ void SaveCardBubbleViewsBrowserTestBase::ClickOnDialogView(views::View* view) { ...@@ -368,7 +346,16 @@ void SaveCardBubbleViewsBrowserTestBase::ClickOnDialogView(views::View* view) {
->non_client_view() ->non_client_view()
->frame_view()); ->frame_view());
bubble_frame_view->ResetViewShownTimeStampForTesting(); bubble_frame_view->ResetViewShownTimeStampForTesting();
ClickOnView(view);
DCHECK(view);
ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
ui::EF_LEFT_MOUSE_BUTTON);
view->OnMousePressed(pressed);
ui::MouseEvent released_event = ui::MouseEvent(
ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
view->OnMouseReleased(released_event);
} }
void SaveCardBubbleViewsBrowserTestBase::ClickOnDialogViewAndWait( void SaveCardBubbleViewsBrowserTestBase::ClickOnDialogViewAndWait(
...@@ -420,13 +407,6 @@ views::View* SaveCardBubbleViewsBrowserTestBase::FindViewInBubbleById( ...@@ -420,13 +407,6 @@ views::View* SaveCardBubbleViewsBrowserTestBase::FindViewInBubbleById(
return specified_view; return specified_view;
} }
void SaveCardBubbleViewsBrowserTestBase::ClickOnCloseButton() {
SaveCardBubbleViews* save_card_bubble_views = GetSaveCardBubbleViews();
DCHECK(save_card_bubble_views);
ClickOnDialogViewAndWait(
save_card_bubble_views->GetBubbleFrameView()->GetCloseButtonForTest());
}
SaveCardBubbleViews* SaveCardBubbleViews*
SaveCardBubbleViewsBrowserTestBase::GetSaveCardBubbleViews() { SaveCardBubbleViewsBrowserTestBase::GetSaveCardBubbleViews() {
SaveCardBubbleControllerImpl* save_card_bubble_controller_impl = SaveCardBubbleControllerImpl* save_card_bubble_controller_impl =
...@@ -440,31 +420,11 @@ SaveCardBubbleViewsBrowserTestBase::GetSaveCardBubbleViews() { ...@@ -440,31 +420,11 @@ SaveCardBubbleViewsBrowserTestBase::GetSaveCardBubbleViews() {
return static_cast<SaveCardBubbleViews*>(save_card_bubble_view); return static_cast<SaveCardBubbleViews*>(save_card_bubble_view);
} }
SaveCardIconView* SaveCardBubbleViewsBrowserTestBase::GetSaveCardIconView() {
if (!browser())
return nullptr;
LocationBarView* location_bar_view =
static_cast<LocationBarView*>(browser()->window()->GetLocationBar());
DCHECK(location_bar_view->save_credit_card_icon_view());
return location_bar_view->save_credit_card_icon_view();
}
content::WebContents* content::WebContents*
SaveCardBubbleViewsBrowserTestBase::GetActiveWebContents() { SaveCardBubbleViewsBrowserTestBase::GetActiveWebContents() {
return browser()->tab_strip_model()->GetActiveWebContents(); return browser()->tab_strip_model()->GetActiveWebContents();
} }
void SaveCardBubbleViewsBrowserTestBase::AddEventObserverToController() {
SaveCardBubbleControllerImpl* save_card_bubble_controller_impl =
SaveCardBubbleControllerImpl::FromWebContents(GetActiveWebContents());
DCHECK(save_card_bubble_controller_impl);
save_card_bubble_controller_impl->SetEventObserverForTesting(this);
}
void SaveCardBubbleViewsBrowserTestBase::ReduceAnimationTime() {
GetSaveCardIconView()->ReduceAnimationTimeForTesting();
}
void SaveCardBubbleViewsBrowserTestBase::ResetEventWaiterForSequence( void SaveCardBubbleViewsBrowserTestBase::ResetEventWaiterForSequence(
std::list<DialogEvent> event_sequence) { std::list<DialogEvent> event_sequence) {
event_waiter_ = event_waiter_ =
......
...@@ -13,10 +13,8 @@ ...@@ -13,10 +13,8 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
#include "chrome/browser/ui/views/autofill/dialog_view_ids.h" #include "chrome/browser/ui/views/autofill/dialog_view_ids.h"
#include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h"
#include "chrome/browser/ui/views/autofill/save_card_icon_view.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "components/autofill/core/browser/credit_card_save_manager.h" #include "components/autofill/core/browser/credit_card_save_manager.h"
#include "components/autofill/core/browser/test_event_waiter.h" #include "components/autofill/core/browser/test_event_waiter.h"
...@@ -38,8 +36,7 @@ namespace autofill { ...@@ -38,8 +36,7 @@ namespace autofill {
// need to show and interact with the offer-to-save bubble. // need to show and interact with the offer-to-save bubble.
class SaveCardBubbleViewsBrowserTestBase class SaveCardBubbleViewsBrowserTestBase
: public InProcessBrowserTest, : public InProcessBrowserTest,
public CreditCardSaveManager::ObserverForTest, public CreditCardSaveManager::ObserverForTest {
public SaveCardBubbleControllerImpl::ObserverForTest {
public: public:
// Various events that can be waited on by the DialogEventWaiter. // Various events that can be waited on by the DialogEventWaiter.
enum DialogEvent : int { enum DialogEvent : int {
...@@ -47,7 +44,6 @@ class SaveCardBubbleViewsBrowserTestBase ...@@ -47,7 +44,6 @@ class SaveCardBubbleViewsBrowserTestBase
REQUESTED_UPLOAD_SAVE, REQUESTED_UPLOAD_SAVE,
RECEIVED_GET_UPLOAD_DETAILS_RESPONSE, RECEIVED_GET_UPLOAD_DETAILS_RESPONSE,
SENT_UPLOAD_CARD_REQUEST, SENT_UPLOAD_CARD_REQUEST,
BUBBLE_SHOWN
}; };
protected: protected:
...@@ -67,9 +63,6 @@ class SaveCardBubbleViewsBrowserTestBase ...@@ -67,9 +63,6 @@ class SaveCardBubbleViewsBrowserTestBase
void OnReceivedGetUploadDetailsResponse() override; void OnReceivedGetUploadDetailsResponse() override;
void OnSentUploadCardRequest() override; void OnSentUploadCardRequest() override;
// SaveCardBubbleControllerImpl::ObserverForTest:
void OnBubbleShown() override;
// BrowserTestBase: // BrowserTestBase:
void SetUpInProcessBrowserTestFixture() override; void SetUpInProcessBrowserTestFixture() override;
...@@ -97,12 +90,9 @@ class SaveCardBubbleViewsBrowserTestBase ...@@ -97,12 +90,9 @@ class SaveCardBubbleViewsBrowserTestBase
void SetUploadDetailsRpcServerError(); void SetUploadDetailsRpcServerError();
// Clicks on the given views::View*. // Clicks on the given views::View*.
void ClickOnView(views::View* view);
// Clicks on the given dialog views::View*.
void ClickOnDialogView(views::View* view); void ClickOnDialogView(views::View* view);
// Clicks on the given dialog views::View* and waits for the dialog to close. // Clicks on the given views::View* and waits for the dialog to close.
void ClickOnDialogViewAndWait(views::View* view); void ClickOnDialogViewAndWait(views::View* view);
// Clicks on a view from within the dialog. // Clicks on a view from within the dialog.
...@@ -114,26 +104,11 @@ class SaveCardBubbleViewsBrowserTestBase ...@@ -114,26 +104,11 @@ class SaveCardBubbleViewsBrowserTestBase
// Returns the views::View* that was previously assigned the id |view_id|. // Returns the views::View* that was previously assigned the id |view_id|.
views::View* FindViewInBubbleById(DialogViewId view_id); views::View* FindViewInBubbleById(DialogViewId view_id);
// Assert that there is a SaveCardBubbleViews bubble open, then click on the
// [X] button.
void ClickOnCloseButton();
// Gets the views::View* instance of the save credit card bubble. // Gets the views::View* instance of the save credit card bubble.
SaveCardBubbleViews* GetSaveCardBubbleViews(); SaveCardBubbleViews* GetSaveCardBubbleViews();
// Gets the views::View* instance of the credit card icon.
SaveCardIconView* GetSaveCardIconView();
content::WebContents* GetActiveWebContents(); content::WebContents* GetActiveWebContents();
// Adding an observer to the controller so we know when the sign-in promo
// shows after the animation.
void AddEventObserverToController();
// Reduces the animation time to one millisecond so that the test does not
// take long.
void ReduceAnimationTime();
// Resets the event waiter for a given |event_sequence|. // Resets the event waiter for a given |event_sequence|.
void ResetEventWaiterForSequence(std::list<DialogEvent> event_sequence); void ResetEventWaiterForSequence(std::list<DialogEvent> event_sequence);
// Wait for the event(s) passed to ResetEventWaiter*() to occur. // Wait for the event(s) passed to ResetEventWaiter*() to occur.
......
...@@ -38,8 +38,6 @@ class SaveCardIconView : public PageActionIconView { ...@@ -38,8 +38,6 @@ class SaveCardIconView : public PageActionIconView {
const gfx::VectorIcon& GetVectorIcon() const override; const gfx::VectorIcon& GetVectorIcon() const override;
private: private:
friend class SaveCardBubbleViewsBrowserTestBase;
SaveCardBubbleControllerImpl* GetController() const; SaveCardBubbleControllerImpl* GetController() const;
// gfx::AnimationDelegate: // gfx::AnimationDelegate:
......
...@@ -35,7 +35,7 @@ views::View* SaveCardManageCardsBubbleViews::CreateFootnoteView() { ...@@ -35,7 +35,7 @@ views::View* SaveCardManageCardsBubbleViews::CreateFootnoteView() {
if (!controller()->ShouldShowSignInPromo()) if (!controller()->ShouldShowSignInPromo())
return nullptr; return nullptr;
views::View* promo_view = nullptr; views::View* footnote_view_ = nullptr;
Profile* profile = controller()->GetProfile(); Profile* profile = controller()->GetProfile();
sync_promo_delegate_ = sync_promo_delegate_ =
...@@ -44,7 +44,7 @@ views::View* SaveCardManageCardsBubbleViews::CreateFootnoteView() { ...@@ -44,7 +44,7 @@ views::View* SaveCardManageCardsBubbleViews::CreateFootnoteView() {
signin_metrics::AccessPoint::ACCESS_POINT_MANAGE_CARDS_BUBBLE); signin_metrics::AccessPoint::ACCESS_POINT_MANAGE_CARDS_BUBBLE);
if (AccountConsistencyModeManager::IsDiceEnabledForProfile(profile)) { if (AccountConsistencyModeManager::IsDiceEnabledForProfile(profile)) {
#if BUILDFLAG(ENABLE_DICE_SUPPORT) #if BUILDFLAG(ENABLE_DICE_SUPPORT)
promo_view = new DiceBubbleSyncPromoView( footnote_view_ = new DiceBubbleSyncPromoView(
profile, sync_promo_delegate_.get(), profile, sync_promo_delegate_.get(),
signin_metrics::AccessPoint::ACCESS_POINT_MANAGE_CARDS_BUBBLE, signin_metrics::AccessPoint::ACCESS_POINT_MANAGE_CARDS_BUBBLE,
IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE, IDS_AUTOFILL_SYNC_PROMO_MESSAGE, IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE, IDS_AUTOFILL_SYNC_PROMO_MESSAGE,
...@@ -53,15 +53,15 @@ views::View* SaveCardManageCardsBubbleViews::CreateFootnoteView() { ...@@ -53,15 +53,15 @@ views::View* SaveCardManageCardsBubbleViews::CreateFootnoteView() {
NOTREACHED(); NOTREACHED();
#endif #endif
} else { } else {
promo_view = new BubbleSyncPromoView( footnote_view_ = new BubbleSyncPromoView(
sync_promo_delegate_.get(), sync_promo_delegate_.get(),
signin_metrics::AccessPoint::ACCESS_POINT_MANAGE_CARDS_BUBBLE, signin_metrics::AccessPoint::ACCESS_POINT_MANAGE_CARDS_BUBBLE,
IDS_AUTOFILL_SIGNIN_PROMO_LINK_DICE_DISABLED, IDS_AUTOFILL_SIGNIN_PROMO_LINK_DICE_DISABLED,
IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE_DICE_DISABLED); IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE_DICE_DISABLED);
} }
InitFootnoteView(promo_view); SetFootnoteViewForTesting(footnote_view_);
return promo_view; return footnote_view_;
} }
views::View* SaveCardManageCardsBubbleViews::CreateExtraView() { views::View* SaveCardManageCardsBubbleViews::CreateExtraView() {
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "chrome/browser/ui/views/autofill/save_card_offer_bubble_views.h" #include "chrome/browser/ui/views/autofill/save_card_offer_bubble_views.h"
#include <memory>
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/app/vector_icons/vector_icons.h"
...@@ -58,11 +56,12 @@ views::View* SaveCardOfferBubbleViews::CreateFootnoteView() { ...@@ -58,11 +56,12 @@ views::View* SaveCardOfferBubbleViews::CreateFootnoteView() {
if (controller()->GetLegalMessageLines().empty()) if (controller()->GetLegalMessageLines().empty())
return nullptr; return nullptr;
legal_message_view_ = footnote_view_ =
new LegalMessageView(controller()->GetLegalMessageLines(), this); new LegalMessageView(controller()->GetLegalMessageLines(), this);
footnote_view_->set_id(DialogViewId::FOOTNOTE_VIEW);
InitFootnoteView(legal_message_view_); SetFootnoteViewForTesting(footnote_view_);
return legal_message_view_; return footnote_view_;
} }
bool SaveCardOfferBubbleViews::Accept() { bool SaveCardOfferBubbleViews::Accept() {
...@@ -102,7 +101,7 @@ void SaveCardOfferBubbleViews::StyledLabelLinkClicked(views::StyledLabel* label, ...@@ -102,7 +101,7 @@ void SaveCardOfferBubbleViews::StyledLabelLinkClicked(views::StyledLabel* label,
if (!controller()) if (!controller())
return; return;
legal_message_view_->OnLinkClicked(label, range, web_contents_); footnote_view_->OnLinkClicked(label, range, web_contents_);
} }
void SaveCardOfferBubbleViews::ContentsChanged( void SaveCardOfferBubbleViews::ContentsChanged(
......
...@@ -55,7 +55,7 @@ class SaveCardOfferBubbleViews : public SaveCardBubbleViews, ...@@ -55,7 +55,7 @@ class SaveCardOfferBubbleViews : public SaveCardBubbleViews,
views::Textfield* cardholder_name_textfield_ = nullptr; views::Textfield* cardholder_name_textfield_ = nullptr;
LegalMessageView* legal_message_view_ = nullptr; LegalMessageView* footnote_view_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(SaveCardOfferBubbleViews); DISALLOW_COPY_AND_ASSIGN(SaveCardOfferBubbleViews);
}; };
......
...@@ -48,7 +48,6 @@ SaveCardSignInPromoBubbleViews::CreateMainContentView() { ...@@ -48,7 +48,6 @@ SaveCardSignInPromoBubbleViews::CreateMainContentView() {
provider->GetDistanceMetric(views::DISTANCE_UNRELATED_CONTROL_VERTICAL))); provider->GetDistanceMetric(views::DISTANCE_UNRELATED_CONTROL_VERTICAL)));
view->set_id(DialogViewId::SIGN_IN_PROMO_VIEW); view->set_id(DialogViewId::SIGN_IN_PROMO_VIEW);
std::unique_ptr<views::View> signin_view;
Profile* profile = controller()->GetProfile(); Profile* profile = controller()->GetProfile();
sync_promo_delegate_ = sync_promo_delegate_ =
std::make_unique<SaveCardSignInPromoBubbleViews::SyncPromoDelegate>( std::make_unique<SaveCardSignInPromoBubbleViews::SyncPromoDelegate>(
...@@ -56,21 +55,19 @@ SaveCardSignInPromoBubbleViews::CreateMainContentView() { ...@@ -56,21 +55,19 @@ SaveCardSignInPromoBubbleViews::CreateMainContentView() {
signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE); signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE);
if (AccountConsistencyModeManager::IsDiceEnabledForProfile(profile)) { if (AccountConsistencyModeManager::IsDiceEnabledForProfile(profile)) {
#if BUILDFLAG(ENABLE_DICE_SUPPORT) #if BUILDFLAG(ENABLE_DICE_SUPPORT)
signin_view = std::make_unique<DiceBubbleSyncPromoView>( view->AddChildView(new DiceBubbleSyncPromoView(
profile, sync_promo_delegate_.get(), profile, sync_promo_delegate_.get(),
signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE); signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE));
#else #else
NOTREACHED(); NOTREACHED();
#endif #endif
} else { } else {
signin_view = std::make_unique<BubbleSyncPromoView>( view->AddChildView(new BubbleSyncPromoView(
sync_promo_delegate_.get(), sync_promo_delegate_.get(),
signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE, signin_metrics::AccessPoint::ACCESS_POINT_SAVE_CARD_BUBBLE,
IDS_AUTOFILL_SIGNIN_PROMO_LINK_DICE_DISABLED, IDS_AUTOFILL_SIGNIN_PROMO_LINK_DICE_DISABLED,
IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE_DICE_DISABLED); IDS_AUTOFILL_SIGNIN_PROMO_MESSAGE_DICE_DISABLED));
} }
signin_view->set_id(DialogViewId::SIGN_IN_VIEW);
view->AddChildView(signin_view.release());
return view; return view;
} }
......
...@@ -538,10 +538,6 @@ void IconLabelBubbleView::ResetSlideAnimation(bool show_label) { ...@@ -538,10 +538,6 @@ void IconLabelBubbleView::ResetSlideAnimation(bool show_label) {
slide_animation_.Reset(show_label); slide_animation_.Reset(show_label);
} }
void IconLabelBubbleView::ReduceAnimationTimeForTesting() {
slide_animation_.SetSlideDuration(1);
}
void IconLabelBubbleView::PauseAnimation() { void IconLabelBubbleView::PauseAnimation() {
if (slide_animation_.is_animating()) { if (slide_animation_.is_animating()) {
// If the user clicks while we're animating, the bubble arrow will be // If the user clicks while we're animating, the bubble arrow will be
......
...@@ -185,10 +185,6 @@ class IconLabelBubbleView : public views::InkDropObserver, ...@@ -185,10 +185,6 @@ class IconLabelBubbleView : public views::InkDropObserver,
// currently paused. // currently paused.
bool is_animation_paused() const { return is_animation_paused_; } bool is_animation_paused() const { return is_animation_paused_; }
// Reduces the slide duration to 1ms such that animation still follows
// through in the code but is short enough that it is essentially skipped.
void ReduceAnimationTimeForTesting();
private: private:
// Spacing between the image and the label. // Spacing between the image and the label.
int GetInternalSpacing() const; int GetInternalSpacing() const;
......
...@@ -110,10 +110,6 @@ void DiceBubbleSyncPromoView::ButtonPressed(views::Button* sender, ...@@ -110,10 +110,6 @@ void DiceBubbleSyncPromoView::ButtonPressed(views::Button* sender,
NOTREACHED(); NOTREACHED();
} }
views::View* DiceBubbleSyncPromoView::GetSigninButtonForTesting() {
return signin_button_view_ ? signin_button_view_->signin_button() : nullptr;
}
void DiceBubbleSyncPromoView::EnableSync( void DiceBubbleSyncPromoView::EnableSync(
bool is_default_promo_account, bool is_default_promo_account,
const base::Optional<AccountInfo>& account) { const base::Optional<AccountInfo>& account) {
......
...@@ -52,9 +52,6 @@ class DiceBubbleSyncPromoView : public views::View, ...@@ -52,9 +52,6 @@ class DiceBubbleSyncPromoView : public views::View,
// views::ButtonListener: // views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override; void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// Returns the sign-in button.
views::View* GetSigninButtonForTesting();
private: private:
// Used to enable sync in the DiceAccountsMenu and when |signin_button_| is // Used to enable sync in the DiceAccountsMenu and when |signin_button_| is
// pressed. // pressed.
......
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