| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 987 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 988 switches::kDisablePopupBlocking); | 988 switches::kDisablePopupBlocking); |
| 989 | 989 |
| 990 // Create http and https servers for a cross-site transition. | 990 // Create http and https servers for a cross-site transition. |
| 991 ASSERT_TRUE(embedded_test_server()->Start()); | 991 ASSERT_TRUE(embedded_test_server()->Start()); |
| 992 net::EmbeddedTestServer https_test_server( | 992 net::EmbeddedTestServer https_test_server( |
| 993 net::EmbeddedTestServer::TYPE_HTTPS); | 993 net::EmbeddedTestServer::TYPE_HTTPS); |
| 994 https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); | 994 https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); |
| 995 ASSERT_TRUE(https_test_server.Start()); | 995 ASSERT_TRUE(https_test_server.Start()); |
| 996 GURL http_url(embedded_test_server()->GetURL("/title1.html")); | 996 GURL http_url(embedded_test_server()->GetURL("/title1.html")); |
| 997 GURL https_url(https_test_server.GetURL(std::string("/"))); | 997 GURL https_url(https_test_server.GetURL("/title2.html")); |
| 998 | 998 |
| 999 // Start with an http URL. | 999 // Start with an http URL. |
| 1000 ui_test_utils::NavigateToURL(browser(), http_url); | 1000 ui_test_utils::NavigateToURL(browser(), http_url); |
| 1001 WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents(); | 1001 WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1002 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); | 1002 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); |
| 1003 | 1003 |
| 1004 // Now open a tab to a blank page, set its opener to null, and redirect it | 1004 // Now open a tab to a blank page, set its opener to null, and redirect it |
| 1005 // cross-site. | 1005 // cross-site. |
| 1006 std::string redirect_popup = "w=window.open();"; | 1006 std::string redirect_popup = "w=window.open();"; |
| 1007 redirect_popup += "w.opener=null;"; | 1007 redirect_popup += "w.opener=null;"; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1076 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1077 switches::kDisablePopupBlocking); | 1077 switches::kDisablePopupBlocking); |
| 1078 | 1078 |
| 1079 // Create http and https servers for a cross-site transition. | 1079 // Create http and https servers for a cross-site transition. |
| 1080 ASSERT_TRUE(embedded_test_server()->Start()); | 1080 ASSERT_TRUE(embedded_test_server()->Start()); |
| 1081 net::EmbeddedTestServer https_test_server( | 1081 net::EmbeddedTestServer https_test_server( |
| 1082 net::EmbeddedTestServer::TYPE_HTTPS); | 1082 net::EmbeddedTestServer::TYPE_HTTPS); |
| 1083 https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); | 1083 https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); |
| 1084 ASSERT_TRUE(https_test_server.Start()); | 1084 ASSERT_TRUE(https_test_server.Start()); |
| 1085 GURL http_url(embedded_test_server()->GetURL("/title1.html")); | 1085 GURL http_url(embedded_test_server()->GetURL("/title1.html")); |
| 1086 GURL https_url(https_test_server.GetURL("/")); | 1086 GURL https_url(https_test_server.GetURL("/title2.html")); |
| 1087 | 1087 |
| 1088 // Start with an http URL. | 1088 // Start with an http URL. |
| 1089 ui_test_utils::NavigateToURL(browser(), http_url); | 1089 ui_test_utils::NavigateToURL(browser(), http_url); |
| 1090 WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents(); | 1090 WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1091 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); | 1091 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); |
| 1092 | 1092 |
| 1093 // Now open a tab to a blank page, set its opener to null, and redirect it | 1093 // Now open a tab to a blank page, set its opener to null, and redirect it |
| 1094 // cross-site. | 1094 // cross-site. |
| 1095 std::string dont_fork_popup = "w=window.open();"; | 1095 std::string dont_fork_popup = "w=window.open();"; |
| 1096 dont_fork_popup += "w.document.location=\""; | 1096 dont_fork_popup += "w.document.location=\""; |
| (...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2867 Browser* browser = new Browser(params); | 2867 Browser* browser = new Browser(params); |
| 2868 gfx::Rect bounds = browser->window()->GetBounds(); | 2868 gfx::Rect bounds = browser->window()->GetBounds(); |
| 2869 | 2869 |
| 2870 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2870 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
| 2871 // See https://crbug.com/567925. | 2871 // See https://crbug.com/567925. |
| 2872 EXPECT_GE(bounds.width(), 100); | 2872 EXPECT_GE(bounds.width(), 100); |
| 2873 EXPECT_EQ(122, bounds.height()); | 2873 EXPECT_EQ(122, bounds.height()); |
| 2874 browser->window()->Close(); | 2874 browser->window()->Close(); |
| 2875 } | 2875 } |
| 2876 } | 2876 } |
| OLD | NEW |