| 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/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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 ASSERT_EQ(3, browser()->tab_count()); | 380 ASSERT_EQ(3, browser()->tab_count()); |
| 381 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", | 381 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", |
| 382 browser()->GetWebContentsAt(2)->GetController(). | 382 browser()->GetWebContentsAt(2)->GetController(). |
| 383 GetLastCommittedEntry()->GetURL().path()); | 383 GetLastCommittedEntry()->GetURL().path()); |
| 384 EXPECT_EQ(browser()->GetWebContentsAt(1)->GetRenderProcessHost(), | 384 EXPECT_EQ(browser()->GetWebContentsAt(1)->GetRenderProcessHost(), |
| 385 browser()->GetWebContentsAt(2)->GetRenderProcessHost()); | 385 browser()->GetWebContentsAt(2)->GetRenderProcessHost()); |
| 386 } | 386 } |
| 387 | 387 |
| 388 // Ensure that reloading a URL after installing or uninstalling it as an app | 388 // Ensure that reloading a URL after installing or uninstalling it as an app |
| 389 // correctly swaps the process. (http://crbug.com/80621) | 389 // correctly swaps the process. (http://crbug.com/80621) |
| 390 // Disabled until we get a correct fix for 80621. See http://crbug.com/102408. | 390 IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcess) { |
| 391 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { | |
| 392 CommandLine::ForCurrentProcess()->AppendSwitch( | 391 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 393 switches::kDisablePopupBlocking); | 392 switches::kDisablePopupBlocking); |
| 394 | 393 |
| 395 extensions::ProcessMap* process_map = | 394 extensions::ProcessMap* process_map = |
| 396 browser()->profile()->GetExtensionService()->process_map(); | 395 browser()->profile()->GetExtensionService()->process_map(); |
| 397 | 396 |
| 398 host_resolver()->AddRule("*", "127.0.0.1"); | 397 host_resolver()->AddRule("*", "127.0.0.1"); |
| 399 ASSERT_TRUE(test_server()->Start()); | 398 ASSERT_TRUE(test_server()->Start()); |
| 400 | 399 |
| 401 // The app under test acts on URLs whose host is "localhost", | 400 // The app under test acts on URLs whose host is "localhost", |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 contents->GetRenderProcessHost()->GetID())); | 459 contents->GetRenderProcessHost()->GetID())); |
| 461 | 460 |
| 462 // Disable app and reload via JavaScript. | 461 // Disable app and reload via JavaScript. |
| 463 DisableExtension(app->id()); | 462 DisableExtension(app->id()); |
| 464 ui_test_utils::WindowedNotificationObserver js_reload_observer2( | 463 ui_test_utils::WindowedNotificationObserver js_reload_observer2( |
| 465 content::NOTIFICATION_LOAD_STOP, | 464 content::NOTIFICATION_LOAD_STOP, |
| 466 content::Source<NavigationController>( | 465 content::Source<NavigationController>( |
| 467 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 466 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
| 468 GetController())); | 467 GetController())); |
| 469 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->GetRenderViewHost(), | 468 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->GetRenderViewHost(), |
| 470 L"", L"location.reload();")); | 469 L"", L"location = location;")); |
| 471 js_reload_observer2.Wait(); | 470 js_reload_observer2.Wait(); |
| 472 EXPECT_FALSE(process_map->Contains( | 471 EXPECT_FALSE(process_map->Contains( |
| 473 contents->GetRenderProcessHost()->GetID())); | 472 contents->GetRenderProcessHost()->GetID())); |
| 474 } | 473 } |
| 475 | 474 |
| 476 // Tests that if we have a non-app process (path3/container.html) that has an | 475 // Tests that if we have a non-app process (path3/container.html) that has an |
| 477 // iframe with a URL in the app's extent (path1/iframe.html), then opening a | 476 // iframe with a URL in the app's extent (path1/iframe.html), then opening a |
| 478 // link from that iframe to a new window to a URL in the app's extent (path1/ | 477 // link from that iframe to a new window to a URL in the app's extent (path1/ |
| 479 // empty.html) results in the new window being in an app process. See | 478 // empty.html) results in the new window being in an app process. See |
| 480 // http://crbug.com/89272 for more details. | 479 // http://crbug.com/89272 for more details. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 658 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
| 660 GetController())); | 659 GetController())); |
| 661 browser()->Reload(CURRENT_TAB); | 660 browser()->Reload(CURRENT_TAB); |
| 662 observer.Wait(); | 661 observer.Wait(); |
| 663 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 662 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 664 contents->GetRenderViewHost(), L"", | 663 contents->GetRenderViewHost(), L"", |
| 665 L"window.domAutomationController.send(chrome.app.isInstalled)", | 664 L"window.domAutomationController.send(chrome.app.isInstalled)", |
| 666 &is_installed)); | 665 &is_installed)); |
| 667 ASSERT_TRUE(is_installed); | 666 ASSERT_TRUE(is_installed); |
| 668 } | 667 } |
| OLD | NEW |