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

Unified Diff: chrome/browser/ui/tests/browser_uitest.cc

Issue 7740028: Use the request's URL rather than the document's when deciding to swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add assertions and fix test. Created 9 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | content/renderer/render_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/tests/browser_uitest.cc
diff --git a/chrome/browser/ui/tests/browser_uitest.cc b/chrome/browser/ui/tests/browser_uitest.cc
index 35a7d8f75996d2436e0728c5e2faee29388dc727..00b4d952efc69bd3d6c8e57f850ad882c211667a 100644
--- a/chrome/browser/ui/tests/browser_uitest.cc
+++ b/chrome/browser/ui/tests/browser_uitest.cc
@@ -74,116 +74,6 @@ TEST_F(BrowserTest, PosixSessionEnd) {
ASSERT_TRUE(exited_cleanly);
}
-// Test that scripts can fork a new renderer process for a tab in a particular
-// case (which matches following a link in Gmail). The script must open a new
-// tab, set its window.opener to null, and redirect it to a cross-site URL.
-// (Bug 1115708)
-// This test can only run if V8 is in use, and not KJS, because KJS will not
-// set window.opener to null properly.
-#ifdef CHROME_V8
-TEST_F(BrowserTest, NullOpenerRedirectForksProcess) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP,
- FilePath(FILE_PATH_LITERAL("chrome/test/data")));
- ASSERT_TRUE(test_server.Start());
-
- FilePath test_file(test_data_directory_);
- scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
- ASSERT_TRUE(window.get());
- scoped_refptr<TabProxy> tab(window->GetActiveTab());
- ASSERT_TRUE(tab.get());
-
- // Start with a file:// url
- test_file = test_file.AppendASCII("title2.html");
- tab->NavigateToURL(net::FilePathToFileURL(test_file));
- int orig_tab_count = -1;
- ASSERT_TRUE(window->GetTabCount(&orig_tab_count));
- int orig_process_count = 0;
- ASSERT_TRUE(GetBrowserProcessCount(&orig_process_count));
- ASSERT_GE(orig_process_count, 1);
-
- // Use JavaScript URL to "fork" a new tab, just like Gmail. (Open tab to a
- // blank page, set its opener to null, and redirect it cross-site.)
- std::wstring url_prefix(L"javascript:(function(){w=window.open();");
- GURL fork_url(url_prefix +
- L"w.opener=null;w.document.location=\"http://localhost:1337\";})()");
-
- // Make sure that a new tab has been created and that we have a new renderer
- // process for it.
- ASSERT_TRUE(tab->NavigateToURLAsync(fork_url));
- PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
- int process_count = 0;
- ASSERT_TRUE(GetBrowserProcessCount(&process_count));
- ASSERT_EQ(orig_process_count + 1, process_count);
- int new_tab_count = -1;
- ASSERT_TRUE(window->GetTabCount(&new_tab_count));
- ASSERT_EQ(orig_tab_count + 1, new_tab_count);
-}
-#endif // CHROME_V8
-
-// This test fails on ChromeOS (it has never been known to work on it).
-// Currently flaky on Windows - it has crashed a couple of times.
-// http://crbug.com/32799
-#if defined(OS_CHROMEOS)
-#define MAYBE_OtherRedirectsDontForkProcess DISABLED_OtherRedirectsDontForkProcess
-#else
-#define MAYBE_OtherRedirectsDontForkProcess FLAKY_OtherRedirectsDontForkProcess
-#endif
-
-// Tests that non-Gmail-like script redirects (i.e., non-null window.opener) or
-// a same-page-redirect) will not fork a new process.
-TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP,
- FilePath(FILE_PATH_LITERAL("chrome/test/data")));
- ASSERT_TRUE(test_server.Start());
-
- FilePath test_file(test_data_directory_);
- scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
- ASSERT_TRUE(window.get());
- scoped_refptr<TabProxy> tab(window->GetActiveTab());
- ASSERT_TRUE(tab.get());
-
- // Start with a file:// url
- test_file = test_file.AppendASCII("title2.html");
- ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
- tab->NavigateToURL(net::FilePathToFileURL(test_file)));
- int orig_tab_count = -1;
- ASSERT_TRUE(window->GetTabCount(&orig_tab_count));
- int orig_process_count = 0;
- ASSERT_TRUE(GetBrowserProcessCount(&orig_process_count));
- ASSERT_GE(orig_process_count, 1);
-
- // Use JavaScript URL to almost fork a new tab, but not quite. (Leave the
- // opener non-null.) Should not fork a process.
- std::string url_str = "javascript:(function(){w=window.open(); ";
- url_str += "w.document.location=\"";
- url_str += test_server.GetURL("").spec();
- url_str += "\";})()";
- GURL dont_fork_url(url_str);
-
- // Make sure that a new tab but not new process has been created.
- ASSERT_TRUE(tab->NavigateToURLAsync(dont_fork_url));
- base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
- int process_count = 0;
- ASSERT_TRUE(GetBrowserProcessCount(&process_count));
- ASSERT_EQ(orig_process_count, process_count);
- int new_tab_count = -1;
- ASSERT_TRUE(window->GetTabCount(&new_tab_count));
- ASSERT_EQ(orig_tab_count + 1, new_tab_count);
-
- // Same thing if the current tab tries to redirect itself.
- url_str = "javascript:(function(){w=window.open(); ";
- url_str += "document.location=\"";
- url_str += test_server.GetURL("").spec();
- url_str += "\";})()";
- GURL dont_fork_url2(url_str);
-
- // Make sure that no new process has been created.
- ASSERT_TRUE(tab->NavigateToURLAsync(dont_fork_url2));
- base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
- ASSERT_TRUE(GetBrowserProcessCount(&process_count));
- ASSERT_EQ(orig_process_count, process_count);
-}
-
// WindowOpenClose is flaky on ChromeOS and fails consistently on linux views.
// See http://crbug.com/85763.
#if defined (OS_CHROMEOS)
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | content/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698