OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/process_map.h" | 9 #include "chrome/browser/extensions/process_map.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 ASSERT_TRUE(test_server()->Start()); | 341 ASSERT_TRUE(test_server()->Start()); |
342 | 342 |
343 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); | 343 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); |
344 | 344 |
345 // Open two tabs in the app. | 345 // Open two tabs in the app. |
346 GURL base_url = GetTestBaseURL("app_process"); | 346 GURL base_url = GetTestBaseURL("app_process"); |
347 | 347 |
348 browser()->NewTab(); | 348 browser()->NewTab(); |
349 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); | 349 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); |
350 browser()->NewTab(); | 350 browser()->NewTab(); |
351 // Wait until the second tab finishes its redirect train (2 hops). | 351 // Wait until the second tab finishes its redirect train (3 hops). |
| 352 // 1. We navigate to redirect.html |
| 353 // 2. Renderer navigates and finishes, counting as a load stop. |
| 354 // 3. Renderer issues the meta refresh to navigate to server-redirect. |
| 355 // 4. Renderer is now in a "provisional load", waiting for navigation to |
| 356 // complete. |
| 357 // 5. Browser sees a redirect response from server-redirect to empty.html, and |
| 358 // transfers that to a new navigation, using RequestTransferURL. |
| 359 // 6. We navigate to empty.html. |
| 360 // 7. Renderer is still in a provisional load to server-redirect, so that is |
| 361 // cancelled, and counts as a load stop |
| 362 // 8. Renderer navigates to empty.html, and finishes loading, counting as the |
| 363 // third load stop |
| 364 #if defined(TRANSFER_REDIRECTS_BUG79520) |
| 365 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 366 browser(), base_url.Resolve("path1/redirect.html"), 3); |
| 367 #else |
352 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 368 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
353 browser(), base_url.Resolve("path1/redirect.html"), 2); | 369 browser(), base_url.Resolve("path1/redirect.html"), 2); |
| 370 #endif |
354 | 371 |
355 // 3 tabs, including the initial about:blank. The last 2 should be the same | 372 // 3 tabs, including the initial about:blank. The last 2 should be the same |
356 // process. | 373 // process. |
357 ASSERT_EQ(3, browser()->tab_count()); | 374 ASSERT_EQ(3, browser()->tab_count()); |
358 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", | 375 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", |
359 browser()->GetTabContentsAt(2)->controller(). | 376 browser()->GetTabContentsAt(2)->controller(). |
360 GetLastCommittedEntry()->url().path()); | 377 GetLastCommittedEntry()->url().path()); |
361 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host(); | 378 EXPECT_EQ(browser()->GetTabContentsAt(1)->render_view_host()->process(), |
362 EXPECT_EQ(host->process(), | |
363 browser()->GetTabContentsAt(2)->render_view_host()->process()); | 379 browser()->GetTabContentsAt(2)->render_view_host()->process()); |
364 } | 380 } |
365 | 381 |
366 // Ensure that reloading a URL after installing or uninstalling it as an app | 382 // Ensure that reloading a URL after installing or uninstalling it as an app |
367 // correctly swaps the process. (http://crbug.com/80621) | 383 // correctly swaps the process. (http://crbug.com/80621) |
368 // Disabled until we get a correct fix for 80621. See http://crbug.com/102408. | 384 // Disabled until we get a correct fix for 80621. See http://crbug.com/102408. |
369 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { | 385 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { |
370 CommandLine::ForCurrentProcess()->AppendSwitch( | 386 CommandLine::ForCurrentProcess()->AppendSwitch( |
371 switches::kDisablePopupBlocking); | 387 switches::kDisablePopupBlocking); |
372 | 388 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 content::Source<NavigationController>( | 606 content::Source<NavigationController>( |
591 &browser()->GetSelectedTabContentsWrapper()->controller())); | 607 &browser()->GetSelectedTabContentsWrapper()->controller())); |
592 browser()->Reload(CURRENT_TAB); | 608 browser()->Reload(CURRENT_TAB); |
593 observer.Wait(); | 609 observer.Wait(); |
594 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 610 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
595 contents->render_view_host(), L"", | 611 contents->render_view_host(), L"", |
596 L"window.domAutomationController.send(chrome.app.isInstalled)", | 612 L"window.domAutomationController.send(chrome.app.isInstalled)", |
597 &is_installed)); | 613 &is_installed)); |
598 ASSERT_TRUE(is_installed); | 614 ASSERT_TRUE(is_installed); |
599 } | 615 } |
OLD | NEW |