| 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/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 browser()->tab_strip_model()->GetWebContentsAt(2)-> | 370 browser()->tab_strip_model()->GetWebContentsAt(2)-> |
| 371 GetRenderProcessHost()); | 371 GetRenderProcessHost()); |
| 372 } | 372 } |
| 373 | 373 |
| 374 // Tests that app process switching works properly in the following scenario: | 374 // Tests that app process switching works properly in the following scenario: |
| 375 // 1. navigate to a page1 in the app | 375 // 1. navigate to a page1 in the app |
| 376 // 2. page1 redirects to a page2 outside the app extent (ie, "/server-redirect") | 376 // 2. page1 redirects to a page2 outside the app extent (ie, "/server-redirect") |
| 377 // 3. page2 redirects back to a page in the app | 377 // 3. page2 redirects back to a page in the app |
| 378 // The final navigation should end up in the app process. | 378 // The final navigation should end up in the app process. |
| 379 // See http://crbug.com/61757 | 379 // See http://crbug.com/61757 |
| 380 // Flaky - see http://crbug.com/341898 | 380 // Flaky on Linux. http://crbug.com/341898 |
| 381 IN_PROC_BROWSER_TEST_F(AppApiTest, FLAKY_AppProcessRedirectBack) { | 381 #if defined(OS_LINUX) |
| 382 #define MAYBE_AppProcessRedirectBack DISABLED_AppProcessRedirectBack |
| 383 #else |
| 384 #define MAYBE_AppProcessRedirectBack AppProcessRedirectBack |
| 385 #endif |
| 386 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcessRedirectBack) { |
| 382 host_resolver()->AddRule("*", "127.0.0.1"); | 387 host_resolver()->AddRule("*", "127.0.0.1"); |
| 383 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 388 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 384 | 389 |
| 385 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); | 390 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); |
| 386 | 391 |
| 387 // Open two tabs in the app. | 392 // Open two tabs in the app. |
| 388 GURL base_url = GetTestBaseURL("app_process"); | 393 GURL base_url = GetTestBaseURL("app_process"); |
| 389 | 394 |
| 390 chrome::NewTab(browser()); | 395 chrome::NewTab(browser()); |
| 391 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); | 396 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 // Navigate the popup to another process outside the app. | 872 // Navigate the popup to another process outside the app. |
| 868 GURL non_app_url(base_url.Resolve("path3/empty.html")); | 873 GURL non_app_url(base_url.Resolve("path3/empty.html")); |
| 869 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); | 874 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); |
| 870 SiteInstance* new_instance = popup_contents->GetSiteInstance(); | 875 SiteInstance* new_instance = popup_contents->GetSiteInstance(); |
| 871 EXPECT_NE(app_instance, new_instance); | 876 EXPECT_NE(app_instance, new_instance); |
| 872 | 877 |
| 873 // It should still be in the same BrowsingInstance, allowing postMessage to | 878 // It should still be in the same BrowsingInstance, allowing postMessage to |
| 874 // work. | 879 // work. |
| 875 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); | 880 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); |
| 876 } | 881 } |
| OLD | NEW |