Commit 9030787e authored by Sahel Sharify's avatar Sahel Sharify Committed by Commit Bot

[Payments] payment apps without name/icon should not be pre-selectable.

On android web-based payment apps with missing name or icon are not
pre-selectable. This cl is changing the desktop implementation to match
Androud.

Bug: 1029373
Change-Id: Ic496ba7d9e9884615e58c4c8fc00882be51417a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1943267
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720537}
parent 9980f3ed
...@@ -43,6 +43,11 @@ public class PaymentManifestDownloaderTest implements ManifestDownloadCallback { ...@@ -43,6 +43,11 @@ public class PaymentManifestDownloaderTest implements ManifestDownloadCallback {
private static final String EXPECTED_WEB_APP_MANIFEST = "{\n" private static final String EXPECTED_WEB_APP_MANIFEST = "{\n"
+ " \"name\": \"BobPay\",\n" + " \"name\": \"BobPay\",\n"
+ " \"icons\": [{\n"
+ " \"src\": \"icon.png\",\n"
+ " \"sizes\": \"48x48\",\n"
+ " \"type\": \"image/png\"\n"
+ " }],\n"
+ " \"related_applications\": [{\n" + " \"related_applications\": [{\n"
+ " \"platform\": \"play\",\n" + " \"platform\": \"play\",\n"
+ " \"id\": \"com.bobpay\",\n" + " \"id\": \"com.bobpay\",\n"
......
...@@ -599,6 +599,8 @@ bool PaymentRequest::SatisfiesSkipUIConstraints() { ...@@ -599,6 +599,8 @@ bool PaymentRequest::SatisfiesSkipUIConstraints() {
is_show_user_gesture_ && state()->IsInitialized() && is_show_user_gesture_ && state()->IsInitialized() &&
spec()->IsInitialized() && state()->available_apps().size() == 1 && spec()->IsInitialized() && state()->available_apps().size() == 1 &&
spec()->stringified_method_data().size() == 1 && spec()->stringified_method_data().size() == 1 &&
// The available app should be preselectable.
state()->selected_app() != nullptr &&
(!spec()->request_shipping() || (!spec()->request_shipping() ||
state()->available_apps().front()->HandlesShippingAddress()) && state()->available_apps().front()->HandlesShippingAddress()) &&
(!spec()->request_payer_name() || (!spec()->request_payer_name() ||
......
...@@ -587,8 +587,7 @@ void PaymentRequestState::SetDefaultProfileSelections() { ...@@ -587,8 +587,7 @@ void PaymentRequestState::SetDefaultProfileSelections() {
PaymentApp::SortApps(&available_apps_); PaymentApp::SortApps(&available_apps_);
selected_app_ = nullptr; selected_app_ = nullptr;
if (!available_apps_.empty() && available_apps_[0]->IsCompleteForPayment() && if (!available_apps_.empty() && available_apps_[0]->CanPreselect()) {
available_apps_[0]->IsExactlyMatchingMerchantRequest()) {
selected_app_ = available_apps_[0].get(); selected_app_ = available_apps_[0].get();
} }
......
{ {
"name": "AlicePay", "name": "AlicePay",
"icons": [{
"src": "icon.png",
"sizes": "48x48",
"type": "image/png"
}],
"related_applications": [{ "related_applications": [{
"platform": "play", "platform": "play",
"id": "com.alicepay", "id": "com.alicepay",
......
...@@ -9,6 +9,7 @@ found in the LICENSE file. ...@@ -9,6 +9,7 @@ found in the LICENSE file.
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Alice Pay 1</title> <title>Alice Pay 1</title>
<link rel="manifest" href="../app.json">
</head> </head>
<body> <body>
<script src="index.js"></script> <script src="index.js"></script>
......
...@@ -9,6 +9,7 @@ found in the LICENSE file. ...@@ -9,6 +9,7 @@ found in the LICENSE file.
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Alice Pay 2</title> <title>Alice Pay 2</title>
<link rel="manifest" href="../app.json">
</head> </head>
<body> <body>
<script src="index.js"></script> <script src="index.js"></script>
......
{ {
"name": "BobPay", "name": "BobPay",
"icons": [{
"src": "icon.png",
"sizes": "48x48",
"type": "image/png"
}],
"related_applications": [{ "related_applications": [{
"platform": "play", "platform": "play",
"id": "com.bobpay", "id": "com.bobpay",
......
...@@ -9,6 +9,7 @@ found in the LICENSE file. ...@@ -9,6 +9,7 @@ found in the LICENSE file.
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bob Pay 1</title> <title>Bob Pay 1</title>
<link rel="manifest" href="../app.json">
</head> </head>
<body> <body>
<script src="index.js"></script> <script src="index.js"></script>
......
{
"name": "AppPay",
"icons": [{
"src": "icon.png",
"sizes": "48x48",
"type": "image/png"
}]
}
\ No newline at end of file
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Show Promise Test For Digital Goods</title> <title>Show Promise Test For Digital Goods</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="create()" id="create">Create</button></div> <div><button onclick="create()" id="create">Create</button></div>
......
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Test for Show Promise with Invalid Details</title> <title>Test for Show Promise with Invalid Details</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="buy()" id="buy">Buy</button></div> <div><button onclick="buy()" id="buy">Buy</button></div>
......
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Test for Rejecting the Show Promise</title> <title>Test for Rejecting the Show Promise</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="buy()" id="buy">Buy</button></div> <div><button onclick="buy()" id="buy">Buy</button></div>
......
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Test For Show Promise That Resolves With Empty Dictionary</title> <title>Test For Show Promise That Resolves With Empty Dictionary</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="buy()" id="buy">Buy</button></div> <div><button onclick="buy()" id="buy">Buy</button></div>
......
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Test For Resolving The Show Promise With Empty Lists Items</title> <title>Test For Resolving The Show Promise With Empty Lists Items</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="buy()" id="buy">Buy</button></div> <div><button onclick="buy()" id="buy">Buy</button></div>
......
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Show Promise Test For Single-Option Shipping</title> <title>Show Promise Test For Single-Option Shipping</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="buy()" id="buy">Buy</button></div> <div><button onclick="buy()" id="buy">Buy</button></div>
......
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Show Promise Test For Single-Option Shipping With Update</title> <title>Show Promise Test For Single-Option Shipping With Update</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="buy()" id="buy">Buy</button></div> <div><button onclick="buy()" id="buy">Buy</button></div>
......
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Test for Timing Out the Show Promise</title> <title>Test for Timing Out the Show Promise</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="buy()" id="buy">Buy</button></div> <div><button onclick="buy()" id="buy">Buy</button></div>
......
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Test for Show Promise with Unsupported Payment Method Identifier</title> <title>Test for Show Promise with Unsupported Payment Method Identifier</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="buy()" id="buy">Buy</button></div> <div><button onclick="buy()" id="buy">Buy</button></div>
......
...@@ -10,6 +10,7 @@ found in the LICENSE file. ...@@ -10,6 +10,7 @@ found in the LICENSE file.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<title>Show Promise Test For US-Only Shipping</title> <title>Show Promise Test For US-Only Shipping</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="manifest" href="app.json">
</head> </head>
<body> <body>
<div><button onclick="buy()" id="buy">Buy</button></div> <div><button onclick="buy()" id="buy">Buy</button></div>
......
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