OLD | NEW |
---|---|
(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/test/browser_test_utils.h" | |
16 #include "content/public/test/test_utils.h" | |
17 #include "net/dns/mock_host_resolver.h" | |
18 #include "net/test/embedded_test_server/embedded_test_server.h" | |
19 #include "url/gurl.h" | |
20 #include "url/url_constants.h" | |
21 | |
22 namespace payments { | |
23 | |
24 class SitePerProcessPaymentsBrowserTest : public InProcessBrowserTest { | |
25 public: | |
26 SitePerProcessPaymentsBrowserTest() {} | |
27 ~SitePerProcessPaymentsBrowserTest() override {} | |
28 | |
29 private: | |
30 void SetUpCommandLine(base::CommandLine* command_line) override { | |
31 InProcessBrowserTest::SetUpCommandLine(command_line); | |
32 command_line->AppendSwitch("enable-experimental-web-platform-features"); | |
33 // Append --site-per-process flag. | |
34 content::IsolateAllSitesForTesting(command_line); | |
35 } | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(SitePerProcessPaymentsBrowserTest); | |
38 }; | |
39 | |
40 IN_PROC_BROWSER_TEST_F(SitePerProcessPaymentsBrowserTest, | |
41 IframePaymentRequestDoesNotCrash) { | |
42 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | |
43 https_server.ServeFilesFromSourceDirectory("chrome/test/data"); | |
44 host_resolver()->AddRule("*", "127.0.0.1"); | |
45 content::SetupCrossSiteRedirector(&https_server); | |
46 ASSERT_TRUE(https_server.InitializeAndListen()); | |
47 ASSERT_TRUE(https_server.Start()); | |
48 | |
49 ui_test_utils::NavigateToURL( | |
50 browser(), | |
51 GURL(https_server.GetURL("/payment_request_main.html"))); | |
52 content::WebContents* tab = | |
53 browser()->tab_strip_model()->GetActiveWebContents(); | |
54 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); | |
55 content::RenderFrameHost* frame = ChildFrameAt(tab->GetMainFrame(), 0); | |
56 EXPECT_TRUE(frame); | |
57 EXPECT_NE(frame->GetSiteInstance(), tab->GetMainFrame()->GetSiteInstance()); | |
pals
2016/12/06 09:01:28
This test is failing because iframe is not creatin
please use gerrit instead
2016/12/06 13:24:47
You need to do something like this:
// Navigate
alexmos
2016/12/06 17:50:40
Why do you need to use the HTTPS server? If it's
| |
58 } | |
59 | |
60 } // namespace payments | |
OLD | NEW |