Commit 1b541203 authored by Alex Moshchuk's avatar Alex Moshchuk Committed by Commit Bot

Revert "Reland "[Payments]Don't show "add card" button when basic card is not requested.""

This reverts commit 919ba484.

Reason for revert: New test PaymentMethodViewControllerTest.DoNotShowAddCardWhenBasicCardIsNotSupported is consistently failing on linux-chromeos-chrome.  First failing build: https://ci.chromium.org/p/chrome/builders/ci/linux-chromeos-chrome/2687.

Test output (CRASH):
[ RUN      ] PaymentMethodViewControllerTest.DoNotShowAddCardWhenBasicCardIsNotSupported
[1:1:0204/141234.652201:WARNING:hugepage_text.cc(182)] The ordering seems incorrect, fall back to small page
[7821:7821:0204/141234.715769:WARNING:audio_manager_linux.cc(52)] Falling back to ALSA for audio output. PulseAudio is not available or could not be initialized.
[7821:7884:0204/141234.746168:ERROR:arc_property_util.cc(224)] arc-build-properties is not found
[7821:7884:0204/141234.746216:ERROR:arc_property_util.cc(276)] Failed to read /usr/share/arc/properties/default.prop: No such file or directory (2)
[7821:7884:0204/141234.746237:ERROR:arc_property_util.cc(295)] Failed to expand /usr/share/arc/properties/default.prop
[7821:7821:0204/141234.760051:INFO:profile_network_context_service.cc(246)] Using built-in cert verifier.
[7821:7821:0204/141234.761643:ERROR:proximity_auth_profile_pref_manager.cc(189)] Failed to find local state prefs for current user.
[7821:7821:0204/141234.816422:INFO:profile_network_context_service.cc(246)] Using built-in cert verifier.
[7821:7821:0204/141234.824119:INFO:profile_network_context_service.cc(246)] Using built-in cert verifier.
[7821:7821:0204/141234.827132:WARNING:remote_commands_service.cc(40)] Client is not registered.
[7821:7821:0204/141234.831227:WARNING:wallpaper_controller_client.cc(370)] Cannot get wallpaper files id in RemovePolicyWallpaper. This should never happen under normal circumstances.
[7821:7821:0204/141234.872150:ERROR:account_manager_migrator.cc(256)] Could not find a refresh token for the Device Account.
[7821:7821:0204/141234.876165:WARNING:drivefs_session.cc(62)] DriveFs mount failed with error: 3
[7821:7908:0204/141234.954453:WARNING:google_brand_chromeos.cc(39)] Brand code file missing: /opt/oem/etc/BRAND_CODE
BrowserTestBase received signal: Segmentation fault. Backtrace:
#0 0x55a6a7352149 base::debug::CollectStackTrace()
#1 0x55a6a72c17b3 base::debug::StackTrace::StackTrace()
#2 0x55a6a782e765 content::(anonymous namespace)::DumpStackTraceSignalHandler()
#3 0x7f81d61164b0 (/lib/x86_64-linux-gnu/libc-2.23.so+0x354af)
#4 0x55a6a7a68a22 net::test_server::EmbeddedTestServer::DoAcceptLoop()
#5 0x55a6a730574f base::TaskAnnotator::RunTask()
#6 0x55a6a731511a base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl()
#7 0x55a6a7314eb7 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoSomeWork()
#8 0x55a6a736d6a9 base::MessagePumpLibevent::Run()
#9 0x55a6a73159c8 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run()
#10 0x55a6a72efb57 base::RunLoop::Run()
#11 0x55a6a7328939 base::Thread::ThreadMain()
#12 0x55a6a735f3ce base::(anonymous namespace)::ThreadFunc()
#13 0x7f81d9fbf6ba start_thread
#14 0x7f81d61e841d clone


Original change's description:
> Reland "[Payments]Don't show "add card" button when basic card is not requested."
> 
> This is a reland of 08e5b730. The cl
> got reverted because of the added test failing on ChromeOS_Chrome_Linux
> build.
> 
> Original change's description:
> > [Payments]Don't show "add card" button when basic card is not requested.
> >
> > This is a Desktop only change to ensure that the "add card" button is
> > shown in payment method window only when the "basic card" method is
> > supported.
> >
> > Change-Id: Ibfc31141cf45595c0db216d017b5c8c484094424
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024923
> > Commit-Queue: Sahel Sharify <sahel@chromium.org>
> > Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
> > Reviewed-by: Rouslan Solomakhin <rouslan@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#735978}
> 
> TBR=rouslan@chromium.org
> 
> Change-Id: I90d4febb944d48cfe009c0c0e1511f9d493d1762
> Bug: 1046514
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037639
> Reviewed-by: Sahel Sharify <sahel@chromium.org>
> Commit-Queue: Sahel Sharify <sahel@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#738334}

TBR=rouslan@chromium.org,sahel@chromium.org

Change-Id: Idfe37889ed1bc2effd9bec6ae075559c293a0fcd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1046514
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037828Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738377}
parent 2ae44760
...@@ -180,8 +180,7 @@ PaymentMethodViewController::PaymentMethodViewController( ...@@ -180,8 +180,7 @@ PaymentMethodViewController::PaymentMethodViewController(
PaymentRequestDialogView* dialog) PaymentRequestDialogView* dialog)
: PaymentRequestSheetController(spec, state, dialog), : PaymentRequestSheetController(spec, state, dialog),
payment_method_list_(dialog), payment_method_list_(dialog),
enable_add_card_(!state->is_retry_called() && enable_add_card_(!state->is_retry_called()) {
spec->supports_basic_card()) {
const std::vector<std::unique_ptr<PaymentApp>>& available_apps = const std::vector<std::unique_ptr<PaymentApp>>& available_apps =
state->available_apps(); state->available_apps();
for (const auto& app : available_apps) { for (const auto& app : available_apps) {
......
...@@ -5,74 +5,19 @@ ...@@ -5,74 +5,19 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/autofill/core/browser/autofill_test_utils.h" #include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/personal_data_manager.h"
#include "components/payments/content/payment_request.h" #include "components/payments/content/payment_request.h"
#include "components/payments/content/payment_request_state.h" #include "components/payments/content/payment_request_state.h"
#include "components/payments/content/service_worker_payment_app_finder.h"
#include "components/payments/core/test_payment_manifest_downloader.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace payments { namespace payments {
class PaymentMethodViewControllerTest : public PaymentRequestBrowserTestBase { class PaymentMethodViewControllerTest : public PaymentRequestBrowserTestBase {
protected: protected:
PaymentMethodViewControllerTest() PaymentMethodViewControllerTest() {}
: bobpay_server_(std::make_unique<net::EmbeddedTestServer>(
net::EmbeddedTestServer::TYPE_HTTPS)),
alicepay_server_(std::make_unique<net::EmbeddedTestServer>(
net::EmbeddedTestServer::TYPE_HTTPS)) {}
void SetUpOnMainThread() override {
host_resolver()->AddRule("*", "127.0.0.1");
PaymentRequestBrowserTestBase::SetUpOnMainThread();
}
void StartServerAndInstallAppForMethod(net::EmbeddedTestServer* server,
const std::string& method_name) {
// Set up test server.
DCHECK(server->InitializeAndListen());
server->ServeFilesFromSourceDirectory("components/test/data/payments/" +
method_name);
server->StartAcceptingConnections();
// Install payment app.
ui_test_utils::NavigateToURL(browser(),
server->GetURL(method_name, "/app1/"));
EXPECT_EQ(
"instruments.set(): Payment app for \"https://" + method_name +
"\" method installed.",
content::EvalJsWithManualReply(
GetActiveWebContents(), "install('https://" + method_name + "')"));
}
void SetDownloaderAndIgnorePortInOriginComparisonForTesting() {
content::BrowserContext* context =
GetActiveWebContents()->GetBrowserContext();
auto downloader = std::make_unique<TestDownloader>(
content::BrowserContext::GetDefaultStoragePartition(context)
->GetURLLoaderFactoryForBrowserProcess());
downloader->AddTestServerURL("https://alicepay.com/",
alicepay_server_->GetURL("alicepay.com", "/"));
downloader->AddTestServerURL("https://bobpay.com/",
bobpay_server_->GetURL("bobpay.com", "/"));
ServiceWorkerPaymentAppFinder::GetInstance()
->SetDownloaderAndIgnorePortInOriginComparisonForTesting(
std::move(downloader));
}
net::EmbeddedTestServer* bobpay_server() { return bobpay_server_.get(); }
net::EmbeddedTestServer* alicepay_server() { return alicepay_server_.get(); }
private: private:
std::unique_ptr<net::EmbeddedTestServer> bobpay_server_;
std::unique_ptr<net::EmbeddedTestServer> alicepay_server_;
DISALLOW_COPY_AND_ASSIGN(PaymentMethodViewControllerTest); DISALLOW_COPY_AND_ASSIGN(PaymentMethodViewControllerTest);
}; };
...@@ -184,20 +129,4 @@ IN_PROC_BROWSER_TEST_F(PaymentMethodViewControllerTest, EditButtonOpensEditor) { ...@@ -184,20 +129,4 @@ IN_PROC_BROWSER_TEST_F(PaymentMethodViewControllerTest, EditButtonOpensEditor) {
ClickOnDialogViewAndWait(edit_button); ClickOnDialogViewAndWait(edit_button);
} }
IN_PROC_BROWSER_TEST_F(PaymentMethodViewControllerTest,
DoNotShowAddCardWhenBasicCardIsNotSupported) {
StartServerAndInstallAppForMethod(bobpay_server(), "bobpay.com");
StartServerAndInstallAppForMethod(alicepay_server(), "alicepay.com");
SetDownloaderAndIgnorePortInOriginComparisonForTesting();
NavigateTo("/payment_request_bobpay_test.html");
// Confirm that "Add card" button is not shown since "basic-card" is not
// requested.
InvokePaymentRequestUI();
OpenPaymentMethodScreen();
views::View* add_card_button = dialog_view()->GetViewByID(
static_cast<int>(DialogViewID::PAYMENT_METHOD_ADD_CARD_BUTTON));
EXPECT_EQ(nullptr, add_card_button);
}
} // namespace payments } // namespace payments
...@@ -90,7 +90,6 @@ class ServiceWorkerPaymentAppFinder { ...@@ -90,7 +90,6 @@ class ServiceWorkerPaymentAppFinder {
friend class HybridRequestSkipUITest; friend class HybridRequestSkipUITest;
friend class JourneyLoggerTest; friend class JourneyLoggerTest;
friend class PaymentHandlerJustInTimeInstallationTest; friend class PaymentHandlerJustInTimeInstallationTest;
friend class PaymentMethodViewControllerTest;
ServiceWorkerPaymentAppFinder(); ServiceWorkerPaymentAppFinder();
~ServiceWorkerPaymentAppFinder(); ~ServiceWorkerPaymentAppFinder();
......
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