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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/payments/payment_request_impl.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/browser_tabstrip.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h"
9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h"
11 #include "content/public/browser/render_frame_host.h"
12 #include "content/public/browser/render_view_host.h"
13 #include "content/public/browser/render_widget_host_view.h"
14 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/content_switches.h"
16 #include "content/public/test/browser_test_utils.h"
17 #include "content/public/test/test_utils.h"
18 #include "net/dns/mock_host_resolver.h"
19 #include "net/test/embedded_test_server/embedded_test_server.h"
20 #include "url/gurl.h"
21 #include "url/url_constants.h"
22
23 namespace payments {
24
25 class SitePerProcessPaymentsBrowserTest : public InProcessBrowserTest {
26 public:
27 SitePerProcessPaymentsBrowserTest() {}
28 ~SitePerProcessPaymentsBrowserTest() override {}
29
30 void SetUpCommandLine(base::CommandLine* command_line) override {
31 InProcessBrowserTest::SetUpCommandLine(command_line);
32 // HTTPS server only serves a valid cert for localhost, so this is needed
33 // to load pages from other hosts without an error.
34 command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
35 command_line->AppendSwitch("enable-experimental-web-platform-features");
36 // Append --site-per-process flag.
37 content::IsolateAllSitesForTesting(command_line);
38 }
39
40 void SetUpOnMainThread() override {
41 https_server_.reset(
42 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
43 host_resolver()->AddRule("*", "127.0.0.1");
44 ASSERT_TRUE(https_server_->InitializeAndListen());
45 content::SetupCrossSiteRedirector(https_server_.get());
46 https_server_->ServeFilesFromSourceDirectory("chrome/test/data");
47 https_server_->StartAcceptingConnections();
48 }
49
50 std::unique_ptr<net::EmbeddedTestServer> https_server_;
51
52 private:
53 DISALLOW_COPY_AND_ASSIGN(SitePerProcessPaymentsBrowserTest);
54 };
55
56 IN_PROC_BROWSER_TEST_F(SitePerProcessPaymentsBrowserTest,
57 IframePaymentRequestDoesNotCrash) {
58 GURL url = https_server_->GetURL("a.com", "/payment_request_main.html");
59 ui_test_utils::NavigateToURL(browser(), url);
60
61 content::WebContents* tab =
62 browser()->tab_strip_model()->GetActiveWebContents();
63 GURL iframe_url =
64 https_server_->GetURL("b.com", "/payment_request_iframe.html");
65 EXPECT_TRUE(content::NavigateIframeToURL(tab, "test", iframe_url));
66
67 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing());
68 content::RenderFrameHost* frame = ChildFrameAt(tab->GetMainFrame(), 0);
69 EXPECT_TRUE(frame);
70 EXPECT_NE(frame->GetSiteInstance(), tab->GetMainFrame()->GetSiteInstance());
71 }
72
73 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/payments/payment_request_impl.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698