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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 ASSERT_EQ(3, browser()->tab_count()); | 381 ASSERT_EQ(3, browser()->tab_count()); |
382 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", | 382 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", |
383 browser()->GetWebContentsAt(2)->GetController(). | 383 browser()->GetWebContentsAt(2)->GetController(). |
384 GetLastCommittedEntry()->GetURL().path()); | 384 GetLastCommittedEntry()->GetURL().path()); |
385 EXPECT_EQ(browser()->GetWebContentsAt(1)->GetRenderProcessHost(), | 385 EXPECT_EQ(browser()->GetWebContentsAt(1)->GetRenderProcessHost(), |
386 browser()->GetWebContentsAt(2)->GetRenderProcessHost()); | 386 browser()->GetWebContentsAt(2)->GetRenderProcessHost()); |
387 } | 387 } |
388 | 388 |
389 // Ensure that reloading a URL after installing or uninstalling it as an app | 389 // Ensure that reloading a URL after installing or uninstalling it as an app |
390 // correctly swaps the process. (http://crbug.com/80621) | 390 // correctly swaps the process. (http://crbug.com/80621) |
391 // Disabled until we get a correct fix for 80621. See http://crbug.com/102408. | 391 IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcess) { |
392 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { | |
393 CommandLine::ForCurrentProcess()->AppendSwitch( | 392 CommandLine::ForCurrentProcess()->AppendSwitch( |
394 switches::kDisablePopupBlocking); | 393 switches::kDisablePopupBlocking); |
395 | 394 |
396 extensions::ProcessMap* process_map = | 395 extensions::ProcessMap* process_map = |
397 browser()->profile()->GetExtensionService()->process_map(); | 396 browser()->profile()->GetExtensionService()->process_map(); |
398 | 397 |
399 host_resolver()->AddRule("*", "127.0.0.1"); | 398 host_resolver()->AddRule("*", "127.0.0.1"); |
400 ASSERT_TRUE(test_server()->Start()); | 399 ASSERT_TRUE(test_server()->Start()); |
401 | 400 |
402 // The app under test acts on URLs whose host is "localhost", | 401 // The app under test acts on URLs whose host is "localhost", |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 ui_test_utils::WindowedNotificationObserver reload_observer2( | 439 ui_test_utils::WindowedNotificationObserver reload_observer2( |
441 content::NOTIFICATION_LOAD_STOP, | 440 content::NOTIFICATION_LOAD_STOP, |
442 content::Source<NavigationController>( | 441 content::Source<NavigationController>( |
443 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 442 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
444 GetController())); | 443 GetController())); |
445 browser()->Reload(CURRENT_TAB); | 444 browser()->Reload(CURRENT_TAB); |
446 reload_observer2.Wait(); | 445 reload_observer2.Wait(); |
447 EXPECT_FALSE(process_map->Contains( | 446 EXPECT_FALSE(process_map->Contains( |
448 contents->GetRenderProcessHost()->GetID())); | 447 contents->GetRenderProcessHost()->GetID())); |
449 | 448 |
449 /* | |
450 * Disable JavaScript reload testing, as it is currently not fixed. | |
451 * | |
Charlie Reis
2012/01/26 01:20:23
We don't use multi-line /* */ comments much.
You
nasko
2012/01/26 20:25:57
I've added the check and works to detect regular w
| |
450 // Enable app and reload via JavaScript. | 452 // Enable app and reload via JavaScript. |
451 EnableExtension(app->id()); | 453 EnableExtension(app->id()); |
452 ui_test_utils::WindowedNotificationObserver js_reload_observer( | 454 ui_test_utils::WindowedNotificationObserver js_reload_observer( |
453 content::NOTIFICATION_LOAD_STOP, | 455 content::NOTIFICATION_LOAD_STOP, |
454 content::Source<NavigationController>( | 456 content::Source<NavigationController>( |
455 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 457 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
456 GetController())); | 458 GetController())); |
457 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->GetRenderViewHost(), | 459 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->GetRenderViewHost(), |
458 L"", L"location.reload();")); | 460 L"", L"location.reload();")); |
459 js_reload_observer.Wait(); | 461 js_reload_observer.Wait(); |
460 EXPECT_TRUE(process_map->Contains( | 462 EXPECT_TRUE(process_map->Contains( |
461 contents->GetRenderProcessHost()->GetID())); | 463 contents->GetRenderProcessHost()->GetID())); |
462 | 464 |
463 // Disable app and reload via JavaScript. | 465 // Disable app and reload via JavaScript. |
464 DisableExtension(app->id()); | 466 DisableExtension(app->id()); |
465 ui_test_utils::WindowedNotificationObserver js_reload_observer2( | 467 ui_test_utils::WindowedNotificationObserver js_reload_observer2( |
466 content::NOTIFICATION_LOAD_STOP, | 468 content::NOTIFICATION_LOAD_STOP, |
467 content::Source<NavigationController>( | 469 content::Source<NavigationController>( |
468 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 470 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
469 GetController())); | 471 GetController())); |
470 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->GetRenderViewHost(), | 472 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->GetRenderViewHost(), |
471 L"", L"location.reload();")); | 473 L"", L"location.reload();")); |
472 js_reload_observer2.Wait(); | 474 js_reload_observer2.Wait(); |
473 EXPECT_FALSE(process_map->Contains( | 475 EXPECT_FALSE(process_map->Contains( |
474 contents->GetRenderProcessHost()->GetID())); | 476 contents->GetRenderProcessHost()->GetID())); |
477 */ | |
475 } | 478 } |
476 | 479 |
477 // Tests that if we have a non-app process (path3/container.html) that has an | 480 // Tests that if we have a non-app process (path3/container.html) that has an |
478 // iframe with a URL in the app's extent (path1/iframe.html), then opening a | 481 // iframe with a URL in the app's extent (path1/iframe.html), then opening a |
479 // link from that iframe to a new window to a URL in the app's extent (path1/ | 482 // link from that iframe to a new window to a URL in the app's extent (path1/ |
480 // empty.html) results in the new window being in an app process. See | 483 // empty.html) results in the new window being in an app process. See |
481 // http://crbug.com/89272 for more details. | 484 // http://crbug.com/89272 for more details. |
482 IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { | 485 IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { |
483 CommandLine::ForCurrentProcess()->AppendSwitch( | 486 CommandLine::ForCurrentProcess()->AppendSwitch( |
484 switches::kDisablePopupBlocking); | 487 switches::kDisablePopupBlocking); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 663 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
661 GetController())); | 664 GetController())); |
662 browser()->Reload(CURRENT_TAB); | 665 browser()->Reload(CURRENT_TAB); |
663 observer.Wait(); | 666 observer.Wait(); |
664 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 667 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
665 contents->GetRenderViewHost(), L"", | 668 contents->GetRenderViewHost(), L"", |
666 L"window.domAutomationController.send(chrome.app.isInstalled)", | 669 L"window.domAutomationController.send(chrome.app.isInstalled)", |
667 &is_installed)); | 670 &is_installed)); |
668 ASSERT_TRUE(is_installed); | 671 ASSERT_TRUE(is_installed); |
669 } | 672 } |
OLD | NEW |