Chromium Code Reviews| Index: chrome/browser/extensions/app_process_apitest.cc |
| diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc |
| index dece83cd1df300aba69b9e141e4846e00e929bf3..21127825f178a745b06db8e409cf84ac6609ec20 100644 |
| --- a/chrome/browser/extensions/app_process_apitest.cc |
| +++ b/chrome/browser/extensions/app_process_apitest.cc |
| @@ -61,14 +61,7 @@ static void NavigateTabHelper(TabContents* contents, const GURL& url) { |
| EXPECT_EQ(url, contents->controller().GetLastCommittedEntry()->url()); |
| } |
| -#if defined(OS_WIN) |
| -// AppProcess sometimes hangs on Windows |
| -// http://crbug.com/58810 |
| -#define MAYBE_AppProcess DISABLED_AppProcess |
| -#else |
| -#define MAYBE_AppProcess AppProcess |
| -#endif |
| -IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcess) { |
| +IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { |
| CommandLine::ForCurrentProcess()->AppendSwitch( |
| switches::kDisablePopupBlocking); |
| @@ -145,3 +138,50 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcess) { |
| &windowOpenerValid)); |
| ASSERT_TRUE(windowOpenerValid); |
| } |
| + |
| +// Tests that app process switching works properly in the following scenario: |
| +// 1. navigate to a page1 in the app |
| +// 2. page1 redirects to a page2 outside the app extent |
|
Charlie Reis
2011/01/05 00:57:25
Maybe add "(i.e., /server-redirect)" to make it cl
Matt Perry
2011/01/05 01:14:47
Done.
|
| +// 3. page2 redirects back to a page in the app |
| +// The final navigation should end up in the app process. |
| +// See http://crbug.com/61757 |
| +IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessRedirectBack) { |
| + CommandLine::ForCurrentProcess()->AppendSwitch( |
| + switches::kDisablePopupBlocking); |
| + |
| + host_resolver()->AddRule("*", "127.0.0.1"); |
| + ASSERT_TRUE(test_server()->Start()); |
| + |
| + ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); |
| + |
| + // Open two tabs in the app, one outside it. |
|
Charlie Reis
2011/01/05 00:57:25
Copy/paste bug. (There's no third tab outside the
Matt Perry
2011/01/05 01:14:47
Done.
|
| + GURL base_url = test_server()->GetURL( |
| + "files/extensions/api_test/app_process/"); |
| + |
| + // The app under test acts on URLs whose host is "localhost", |
| + // so the URLs we navigate to must have host "localhost". |
| + GURL::Replacements replace_host; |
| + std::string host_str("localhost"); // must stay in scope with replace_host |
| + replace_host.SetHostStr(host_str); |
| + base_url = base_url.ReplaceComponents(replace_host); |
| + |
| + browser()->NewTab(); |
| + ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); |
| + browser()->NewTab(); |
| + ui_test_utils::NavigateToURL(browser(), |
| + base_url.Resolve("path1/redirect.html")); |
| + |
| + NavigationController& controller = |
| + browser()->GetSelectedTabContents()->controller(); |
| + while (controller.GetActiveEntry()->url().path().find("empty.html") == |
|
Charlie Reis
2011/01/05 00:57:25
"empty.html" is in the redirect URL, too. Could w
Matt Perry
2011/01/05 01:14:47
Good catch! Done.
|
| + std::string::npos) { |
| + ui_test_utils::WaitForNavigation(&controller); |
| + } |
| + |
| + // 3 tabs, including the initial about:blank. The last 2 should be the same |
| + // process. |
| + ASSERT_EQ(3, browser()->tab_count()); |
| + RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host(); |
| + EXPECT_EQ(host->process(), |
| + browser()->GetTabContentsAt(2)->render_view_host()->process()); |
| +} |