Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "sign-in" promo that shows after saving a credit card (uplift to 1.2.x) #4170

Merged
merged 1 commit into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.h"

#include <memory>

#include "base/macros.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"

class BraveSaveCardBubbleControllerImplTest : public InProcessBrowserTest {
public:
BraveSaveCardBubbleControllerImplTest() {}

void ShowUi() {
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();

// Do lazy initialization of SaveCardBubbleControllerImpl.
autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents);
controller_ =
autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents);
DCHECK(controller_);
controller_->ShowBubbleForSignInPromo();
}

autofill::SaveCardBubbleControllerImpl* controller() { return controller_; }

private:
autofill::SaveCardBubbleControllerImpl* controller_ = nullptr;

DISALLOW_COPY_AND_ASSIGN(BraveSaveCardBubbleControllerImplTest);
};

// Tests that requesting to open signin promo bubble doesn't result in the
// bubble being shown.
IN_PROC_BROWSER_TEST_F(BraveSaveCardBubbleControllerImplTest, NoSignInPromo) {
ShowUi();
EXPECT_EQ(nullptr, controller()->save_card_bubble_view());
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Copyright (c) 2019 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#define BRAVE_SHOULD_SHOW_SIGNIN_PROMO_SHORT_CIRCUIT_TO_FALSE \
return false;

#include "../../../../../../../chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc" // NOLINT
#undef BRAVE_SHOULD_SHOW_SIGNIN_PROMO_SHORT_CIRCUIT_TO_FALSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc
index 4e932e3882fe07386deaa030031c15bcc1891dc3..15fdf5240ab7b2b0b9b21c6e27b3b664245a3a0b 100644
--- a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc
+++ b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc
@@ -476,6 +476,7 @@ bool SaveCardBubbleControllerImpl::ShouldRequestExpirationDateFromUser() const {
}

bool SaveCardBubbleControllerImpl::ShouldShowSignInPromo() const {
+ BRAVE_SHOULD_SHOW_SIGNIN_PROMO_SHORT_CIRCUIT_TO_FALSE;
if (is_upload_save_)
return false;