| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/browser_tabstrip.h" | 7 #include "chrome/browser/ui/browser_tabstrip.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| 11 #include "content/public/browser/render_frame_host.h" | 11 #include "content/public/browser/render_frame_host.h" |
| 12 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 13 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/common/content_features.h" | |
| 16 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 17 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" |
| 18 #include "content/public/test/test_utils.h" | 17 #include "content/public/test/test_utils.h" |
| 19 #include "net/dns/mock_host_resolver.h" | 18 #include "net/dns/mock_host_resolver.h" |
| 20 #include "net/test/embedded_test_server/embedded_test_server.h" | 19 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 21 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 22 #include "url/url_constants.h" | 21 #include "url/url_constants.h" |
| 23 | 22 |
| 24 namespace payments { | 23 namespace payments { |
| 25 | 24 |
| 26 class SitePerProcessPaymentsBrowserTest : public InProcessBrowserTest { | 25 class SitePerProcessPaymentsBrowserTest : public InProcessBrowserTest { |
| 27 public: | 26 public: |
| 28 SitePerProcessPaymentsBrowserTest() {} | 27 SitePerProcessPaymentsBrowserTest() {} |
| 29 ~SitePerProcessPaymentsBrowserTest() override {} | 28 ~SitePerProcessPaymentsBrowserTest() override {} |
| 30 | 29 |
| 31 void SetUpCommandLine(base::CommandLine* command_line) override { | 30 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 32 InProcessBrowserTest::SetUpCommandLine(command_line); | 31 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 33 // HTTPS server only serves a valid cert for localhost, so this is needed | 32 // HTTPS server only serves a valid cert for localhost, so this is needed |
| 34 // to load pages from other hosts without an error. | 33 // to load pages from other hosts without an error. |
| 35 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); | 34 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); |
| 36 command_line->AppendSwitch( | 35 |
| 37 switches::kEnableExperimentalWebPlatformFeatures); | |
| 38 command_line->AppendSwitchASCII(switches::kEnableFeatures, | |
| 39 features::kWebPayments.name); | |
| 40 // Append --site-per-process flag. | 36 // Append --site-per-process flag. |
| 41 content::IsolateAllSitesForTesting(command_line); | 37 content::IsolateAllSitesForTesting(command_line); |
| 42 } | 38 } |
| 43 | 39 |
| 44 void SetUpOnMainThread() override { | 40 void SetUpOnMainThread() override { |
| 45 https_server_.reset( | 41 https_server_.reset( |
| 46 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); | 42 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); |
| 47 host_resolver()->AddRule("*", "127.0.0.1"); | 43 host_resolver()->AddRule("*", "127.0.0.1"); |
| 48 ASSERT_TRUE(https_server_->InitializeAndListen()); | 44 ASSERT_TRUE(https_server_->InitializeAndListen()); |
| 49 content::SetupCrossSiteRedirector(https_server_.get()); | 45 content::SetupCrossSiteRedirector(https_server_.get()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 68 https_server_->GetURL("b.com", "/payment_request_iframe.html"); | 64 https_server_->GetURL("b.com", "/payment_request_iframe.html"); |
| 69 EXPECT_TRUE(content::NavigateIframeToURL(tab, "test", iframe_url)); | 65 EXPECT_TRUE(content::NavigateIframeToURL(tab, "test", iframe_url)); |
| 70 | 66 |
| 71 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); | 67 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); |
| 72 content::RenderFrameHost* frame = ChildFrameAt(tab->GetMainFrame(), 0); | 68 content::RenderFrameHost* frame = ChildFrameAt(tab->GetMainFrame(), 0); |
| 73 EXPECT_TRUE(frame); | 69 EXPECT_TRUE(frame); |
| 74 EXPECT_NE(frame->GetSiteInstance(), tab->GetMainFrame()->GetSiteInstance()); | 70 EXPECT_NE(frame->GetSiteInstance(), tab->GetMainFrame()->GetSiteInstance()); |
| 75 } | 71 } |
| 76 | 72 |
| 77 } // namespace payments | 73 } // namespace payments |
| OLD | NEW |