| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 ui_test_utils::NavigateToURLWithDisposition( | 86 ui_test_utils::NavigateToURLWithDisposition( |
| 87 browser(), base_url.Resolve("path1/empty.html"), NEW_FOREGROUND_TAB, | 87 browser(), base_url.Resolve("path1/empty.html"), NEW_FOREGROUND_TAB, |
| 88 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 88 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 89 LOG(INFO) << "Nav 1."; | 89 LOG(INFO) << "Nav 1."; |
| 90 EXPECT_TRUE(process_map->Contains( | 90 EXPECT_TRUE(process_map->Contains( |
| 91 browser()->tab_strip_model()->GetWebContentsAt(1)-> | 91 browser()->tab_strip_model()->GetWebContentsAt(1)-> |
| 92 GetRenderProcessHost()->GetID())); | 92 GetRenderProcessHost()->GetID())); |
| 93 EXPECT_FALSE(browser()->tab_strip_model()->GetWebContentsAt(1)->GetWebUI()); | 93 EXPECT_FALSE(browser()->tab_strip_model()->GetWebContentsAt(1)->GetWebUI()); |
| 94 | 94 |
| 95 content::WindowedNotificationObserver tab_added_observer( | 95 content::WindowedNotificationObserver tab_added_observer( |
| 96 chrome::NOTIFICATION_TAB_ADDED, | 96 content::NOTIFICATION_LOAD_STOP, |
| 97 content::NotificationService::AllSources()); | 97 content::NotificationService::AllSources()); |
| 98 chrome::NewTab(browser()); | 98 chrome::NewTab(browser()); |
| 99 tab_added_observer.Wait(); | 99 tab_added_observer.Wait(); |
| 100 LOG(INFO) << "New tab."; | 100 LOG(INFO) << "New tab."; |
| 101 ui_test_utils::NavigateToURL(browser(), | 101 ui_test_utils::NavigateToURL(browser(), |
| 102 base_url.Resolve("path2/empty.html")); | 102 base_url.Resolve("path2/empty.html")); |
| 103 LOG(INFO) << "Nav 2."; | 103 LOG(INFO) << "Nav 2."; |
| 104 EXPECT_TRUE(process_map->Contains( | 104 EXPECT_TRUE(process_map->Contains( |
| 105 browser()->tab_strip_model()->GetWebContentsAt(2)-> | 105 browser()->tab_strip_model()->GetWebContentsAt(2)-> |
| 106 GetRenderProcessHost()->GetID())); | 106 GetRenderProcessHost()->GetID())); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 // See http://crbug.com/61757 | 375 // See http://crbug.com/61757 |
| 376 IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessRedirectBack) { | 376 IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessRedirectBack) { |
| 377 host_resolver()->AddRule("*", "127.0.0.1"); | 377 host_resolver()->AddRule("*", "127.0.0.1"); |
| 378 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 378 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 379 | 379 |
| 380 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); | 380 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); |
| 381 | 381 |
| 382 // Open two tabs in the app. | 382 // Open two tabs in the app. |
| 383 GURL base_url = GetTestBaseURL("app_process"); | 383 GURL base_url = GetTestBaseURL("app_process"); |
| 384 | 384 |
| 385 content::WindowedNotificationObserver tab_added_observer( |
| 386 content::NOTIFICATION_LOAD_STOP, |
| 387 content::NotificationService::AllSources()); |
| 385 chrome::NewTab(browser()); | 388 chrome::NewTab(browser()); |
| 389 tab_added_observer.Wait(); |
| 386 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); | 390 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); |
| 391 |
| 392 content::WindowedNotificationObserver tab_added_observer2( |
| 393 content::NOTIFICATION_LOAD_STOP, |
| 394 content::NotificationService::AllSources()); |
| 387 chrome::NewTab(browser()); | 395 chrome::NewTab(browser()); |
| 396 tab_added_observer2.Wait(); |
| 388 // Wait until the second tab finishes its redirect train (2 hops). | 397 // Wait until the second tab finishes its redirect train (2 hops). |
| 389 // 1. We navigate to redirect.html | 398 // 1. We navigate to redirect.html |
| 390 // 2. Renderer navigates and finishes, counting as a load stop. | 399 // 2. Renderer navigates and finishes, counting as a load stop. |
| 391 // 3. Renderer issues the meta refresh to navigate to server-redirect. | 400 // 3. Renderer issues the meta refresh to navigate to server-redirect. |
| 392 // 4. Renderer is now in a "provisional load", waiting for navigation to | 401 // 4. Renderer is now in a "provisional load", waiting for navigation to |
| 393 // complete. | 402 // complete. |
| 394 // 5. Browser sees a redirect response from server-redirect to empty.html, and | 403 // 5. Browser sees a redirect response from server-redirect to empty.html, and |
| 395 // transfers that to a new navigation, using RequestTransferURL. | 404 // transfers that to a new navigation, using RequestTransferURL. |
| 396 // 6. Renderer navigates to empty.html, and finishes loading, counting as the | 405 // 6. Renderer navigates to empty.html, and finishes loading, counting as the |
| 397 // second load stop | 406 // second load stop |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 &browser()->tab_strip_model()->GetActiveWebContents()-> | 839 &browser()->tab_strip_model()->GetActiveWebContents()-> |
| 831 GetController())); | 840 GetController())); |
| 832 chrome::Reload(browser(), CURRENT_TAB); | 841 chrome::Reload(browser(), CURRENT_TAB); |
| 833 observer.Wait(); | 842 observer.Wait(); |
| 834 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 843 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 835 contents, | 844 contents, |
| 836 "window.domAutomationController.send(chrome.app.isInstalled)", | 845 "window.domAutomationController.send(chrome.app.isInstalled)", |
| 837 &is_installed)); | 846 &is_installed)); |
| 838 ASSERT_TRUE(is_installed); | 847 ASSERT_TRUE(is_installed); |
| 839 } | 848 } |
| OLD | NEW |