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

Unified Diff: chrome/browser/payments/site_per_process_payments_browsertest.cc

Issue 2545693002: Support allowpaymentrequest with out-of-process iframes (Closed)
Patch Set: Support allowpaymentrequest with out-of-process iframes Created 4 years 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/payments/site_per_process_payments_browsertest.cc
diff --git a/chrome/browser/payments/site_per_process_payments_browsertest.cc b/chrome/browser/payments/site_per_process_payments_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..46220945d7cde99544e46af7ab13ea29032d76a8
--- /dev/null
+++ b/chrome/browser/payments/site_per_process_payments_browsertest.cc
@@ -0,0 +1,66 @@
+// Copyright 2016 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 "base/command_line.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_tabstrip.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 "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/render_widget_host_view.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/common/content_switches.h"
+#include "content/public/test/browser_test_utils.h"
+#include "content/public/test/test_utils.h"
+#include "net/dns/mock_host_resolver.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "url/gurl.h"
+#include "url/url_constants.h"
+
+namespace payments {
+
+class SitePerProcessPaymentsBrowserTest : public InProcessBrowserTest {
+ public:
+ SitePerProcessPaymentsBrowserTest() {}
+ ~SitePerProcessPaymentsBrowserTest() override {}
+
+ private:
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ InProcessBrowserTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
alexmos 2016/12/13 17:26:56 Perhaps add a quick comment mentioning why this sw
pals 2016/12/14 04:01:07 Done.
+ command_line->AppendSwitch("enable-experimental-web-platform-features");
+ // Append --site-per-process flag.
+ content::IsolateAllSitesForTesting(command_line);
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(SitePerProcessPaymentsBrowserTest);
+};
+
+IN_PROC_BROWSER_TEST_F(SitePerProcessPaymentsBrowserTest,
+ IframePaymentRequestDoesNotCrash) {
+ net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(https_server.InitializeAndListen());
+ content::SetupCrossSiteRedirector(&https_server);
+ https_server.ServeFilesFromSourceDirectory("chrome/test/data");
+ https_server.StartAcceptingConnections();
alexmos 2016/12/13 17:26:56 The six lines above might belong better in SetUpOn
pals 2016/12/14 04:01:07 Done.
+
+ GURL url = https_server.GetURL("a.com", "/payment_request_main.html");
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ content::WebContents* tab =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ GURL iframe_url =
+ https_server.GetURL("b.com", "/payment_request_iframe.html");
+ EXPECT_TRUE(content::NavigateIframeToURL(tab, "test", iframe_url));
+
+ EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing());
+ content::RenderFrameHost* frame = ChildFrameAt(tab->GetMainFrame(), 0);
+ EXPECT_TRUE(frame);
+ EXPECT_NE(frame->GetSiteInstance(), tab->GetMainFrame()->GetSiteInstance());
+}
+
+} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698