Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Unified Diff: chrome/browser/ui/views/payments/payment_request_browsertest_base.cc

Issue 2866623003: PaymentRequest.canMakePayment() query quota on desktop. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc b/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
index 34b5bce76b81540df2529c47f9c8d3560151cbd4..34ed492700da513c1fb33da9f47f49335fbc8963 100644
--- a/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
+++ b/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
@@ -12,6 +12,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
@@ -32,7 +33,9 @@
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
+#include "net/dns/mock_host_resolver.h"
#include "services/service_manager/public/cpp/bind_source_info.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -58,10 +61,18 @@ PaymentRequestBrowserTestBase::PaymentRequestBrowserTestBase(
is_valid_ssl_(true) {}
PaymentRequestBrowserTestBase::~PaymentRequestBrowserTestBase() {}
+void PaymentRequestBrowserTestBase::SetUpCommandLine(
+ base::CommandLine* command_line) {
+ // HTTPS server only serves a valid cert for localhost, so this is needed to
+ // load pages from "a.com" without an interstitial.
+ command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
+}
+
void PaymentRequestBrowserTestBase::SetUpOnMainThread() {
// Setup the https server.
https_server_ = base::MakeUnique<net::EmbeddedTestServer>(
net::EmbeddedTestServer::TYPE_HTTPS);
+ host_resolver()->AddRule("a.com", "127.0.0.1");
ASSERT_TRUE(https_server_->InitializeAndListen());
https_server_->ServeFilesFromSourceDirectory("chrome/test/data/payments");
https_server_->StartAcceptingConnections();
@@ -81,7 +92,8 @@ void PaymentRequestBrowserTestBase::SetUpOnMainThread() {
}
void PaymentRequestBrowserTestBase::NavigateTo(const std::string& file_path) {
- ui_test_utils::NavigateToURL(browser(), https_server()->GetURL(file_path));
+ ui_test_utils::NavigateToURL(browser(),
+ https_server()->GetURL("a.com", file_path));
}
void PaymentRequestBrowserTestBase::SetIncognito() {
@@ -410,8 +422,8 @@ void PaymentRequestBrowserTestBase::CreatePaymentRequestForTest(
is_incognito_, is_valid_ssl_);
delegate_ = delegate.get();
PaymentRequestWebContentsManager::GetOrCreateForWebContents(web_contents)
- ->CreatePaymentRequest(web_contents, std::move(delegate),
- std::move(request), this);
+ ->CreatePaymentRequest(web_contents->GetMainFrame(), web_contents,
+ std::move(delegate), std::move(request), this);
}
void PaymentRequestBrowserTestBase::ClickOnDialogViewAndWait(

Powered by Google App Engine
This is Rietveld 408576698