| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // Append --site-per-process flag. | 37 // Append --site-per-process flag. |
| 38 content::IsolateAllSitesForTesting(command_line); | 38 content::IsolateAllSitesForTesting(command_line); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void SetUpOnMainThread() override { | 41 void SetUpOnMainThread() override { |
| 42 https_server_.reset( | 42 https_server_.reset( |
| 43 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); | 43 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); |
| 44 host_resolver()->AddRule("*", "127.0.0.1"); | 44 host_resolver()->AddRule("*", "127.0.0.1"); |
| 45 ASSERT_TRUE(https_server_->InitializeAndListen()); | 45 ASSERT_TRUE(https_server_->InitializeAndListen()); |
| 46 content::SetupCrossSiteRedirector(https_server_.get()); | 46 content::SetupCrossSiteRedirector(https_server_.get()); |
| 47 https_server_->ServeFilesFromSourceDirectory("chrome/test/data"); | 47 https_server_->ServeFilesFromSourceDirectory("chrome/test/data/payments"); |
| 48 https_server_->StartAcceptingConnections(); | 48 https_server_->StartAcceptingConnections(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 std::unique_ptr<net::EmbeddedTestServer> https_server_; | 51 std::unique_ptr<net::EmbeddedTestServer> https_server_; |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(SitePerProcessPaymentsBrowserTest); | 54 DISALLOW_COPY_AND_ASSIGN(SitePerProcessPaymentsBrowserTest); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 IN_PROC_BROWSER_TEST_F(SitePerProcessPaymentsBrowserTest, | 57 IN_PROC_BROWSER_TEST_F(SitePerProcessPaymentsBrowserTest, |
| 58 IframePaymentRequestDoesNotCrash) { | 58 IframePaymentRequestDoesNotCrash) { |
| 59 GURL url = https_server_->GetURL("a.com", "/payment_request_main.html"); | 59 GURL url = https_server_->GetURL("a.com", "/payment_request_main.html"); |
| 60 ui_test_utils::NavigateToURL(browser(), url); | 60 ui_test_utils::NavigateToURL(browser(), url); |
| 61 | 61 |
| 62 content::WebContents* tab = | 62 content::WebContents* tab = |
| 63 browser()->tab_strip_model()->GetActiveWebContents(); | 63 browser()->tab_strip_model()->GetActiveWebContents(); |
| 64 GURL iframe_url = | 64 GURL iframe_url = |
| 65 https_server_->GetURL("b.com", "/payment_request_iframe.html"); | 65 https_server_->GetURL("b.com", "/payment_request_iframe.html"); |
| 66 EXPECT_TRUE(content::NavigateIframeToURL(tab, "test", iframe_url)); | 66 EXPECT_TRUE(content::NavigateIframeToURL(tab, "test", iframe_url)); |
| 67 | 67 |
| 68 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); | 68 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); |
| 69 content::RenderFrameHost* frame = ChildFrameAt(tab->GetMainFrame(), 0); | 69 content::RenderFrameHost* frame = ChildFrameAt(tab->GetMainFrame(), 0); |
| 70 EXPECT_TRUE(frame); | 70 EXPECT_TRUE(frame); |
| 71 EXPECT_NE(frame->GetSiteInstance(), tab->GetMainFrame()->GetSiteInstance()); | 71 EXPECT_NE(frame->GetSiteInstance(), tab->GetMainFrame()->GetSiteInstance()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace payments | 74 } // namespace payments |
| OLD | NEW |