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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 #include "chrome/browser/extensions/extension_host.h" | 6 #include "chrome/browser/extensions/extension_host.h" |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/process_map.h" | 8 #include "chrome/browser/extensions/process_map.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 10 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 js_reload_observer2.Wait(); | 442 js_reload_observer2.Wait(); |
443 EXPECT_FALSE(process_map->Contains( | 443 EXPECT_FALSE(process_map->Contains( |
444 contents->GetRenderProcessHost()->GetID())); | 444 contents->GetRenderProcessHost()->GetID())); |
445 } | 445 } |
446 | 446 |
447 // Tests that if we have a non-app process (path3/container.html) that has an | 447 // Tests that if we have a non-app process (path3/container.html) that has an |
448 // iframe with a URL in the app's extent (path1/iframe.html), then opening a | 448 // iframe with a URL in the app's extent (path1/iframe.html), then opening a |
449 // link from that iframe to a new window to a URL in the app's extent (path1/ | 449 // link from that iframe to a new window to a URL in the app's extent (path1/ |
450 // empty.html) results in the new window being in an app process. See | 450 // empty.html) results in the new window being in an app process. See |
451 // http://crbug.com/89272 for more details. | 451 // http://crbug.com/89272 for more details. |
452 #if defined(OS_CHROMEOS) | 452 IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { |
453 // http://crbug.com/153513 | |
454 #define MAYBE_OpenAppFromIframe DISABLED_OpenAppFromIframe | |
455 #else | |
456 #define MAYBE_OpenAppFromIframe OpenAppFromIframe | |
457 #endif | |
458 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_OpenAppFromIframe) { | |
459 extensions::ProcessMap* process_map = | 453 extensions::ProcessMap* process_map = |
460 browser()->profile()->GetExtensionService()->process_map(); | 454 browser()->profile()->GetExtensionService()->process_map(); |
461 | 455 |
462 host_resolver()->AddRule("*", "127.0.0.1"); | 456 host_resolver()->AddRule("*", "127.0.0.1"); |
463 ASSERT_TRUE(test_server()->Start()); | 457 ASSERT_TRUE(test_server()->Start()); |
464 | 458 |
465 GURL base_url = GetTestBaseURL("app_process"); | 459 GURL base_url = GetTestBaseURL("app_process"); |
466 | 460 |
467 // Load app and start URL (not in the app). | 461 // Load app and start URL (not in the app). |
468 const Extension* app = | 462 const Extension* app = |
(...skipping 10 matching lines...) Expand all Loading... |
479 popup_observer.Wait(); | 473 popup_observer.Wait(); |
480 | 474 |
481 // Popup window should be in the app's process. | 475 // Popup window should be in the app's process. |
482 RenderViewHost* popup_host = | 476 RenderViewHost* popup_host = |
483 content::Source<RenderViewHost>(popup_observer.source()).ptr(); | 477 content::Source<RenderViewHost>(popup_observer.source()).ptr(); |
484 EXPECT_TRUE(process_map->Contains(popup_host->GetProcess()->GetID())); | 478 EXPECT_TRUE(process_map->Contains(popup_host->GetProcess()->GetID())); |
485 } | 479 } |
486 | 480 |
487 // Similar to the previous test, but ensure that popup blocking bypass | 481 // Similar to the previous test, but ensure that popup blocking bypass |
488 // isn't granted to the iframe. See crbug.com/117446. | 482 // isn't granted to the iframe. See crbug.com/117446. |
489 IN_PROC_BROWSER_TEST_F(BlockedAppApiTest, OpenAppFromIframe) { | 483 #if defined(OS_CHROMEOS) |
| 484 // http://crbug.com/153513 |
| 485 #define MAYBE_OpenAppFromIframe DISABLED_OpenAppFromIframe |
| 486 #else |
| 487 #define MAYBE_OpenAppFromIframe OpenAppFromIframe |
| 488 #endif |
| 489 IN_PROC_BROWSER_TEST_F(BlockedAppApiTest, MAYBE_OpenAppFromIframe) { |
490 host_resolver()->AddRule("*", "127.0.0.1"); | 490 host_resolver()->AddRule("*", "127.0.0.1"); |
491 ASSERT_TRUE(test_server()->Start()); | 491 ASSERT_TRUE(test_server()->Start()); |
492 | 492 |
493 // Load app and start URL (not in the app). | 493 // Load app and start URL (not in the app). |
494 const Extension* app = | 494 const Extension* app = |
495 LoadExtension(test_data_dir_.AppendASCII("app_process")); | 495 LoadExtension(test_data_dir_.AppendASCII("app_process")); |
496 ASSERT_TRUE(app); | 496 ASSERT_TRUE(app); |
497 | 497 |
498 content::WindowedNotificationObserver blocker_observer( | 498 content::WindowedNotificationObserver blocker_observer( |
499 chrome::NOTIFICATION_CONTENT_BLOCKED_STATE_CHANGED, | 499 chrome::NOTIFICATION_CONTENT_BLOCKED_STATE_CHANGED, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 content::Source<NavigationController>( | 628 content::Source<NavigationController>( |
629 &chrome::GetActiveWebContents(browser())->GetController())); | 629 &chrome::GetActiveWebContents(browser())->GetController())); |
630 chrome::Reload(browser(), CURRENT_TAB); | 630 chrome::Reload(browser(), CURRENT_TAB); |
631 observer.Wait(); | 631 observer.Wait(); |
632 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 632 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
633 contents->GetRenderViewHost(), L"", | 633 contents->GetRenderViewHost(), L"", |
634 L"window.domAutomationController.send(chrome.app.isInstalled)", | 634 L"window.domAutomationController.send(chrome.app.isInstalled)", |
635 &is_installed)); | 635 &is_installed)); |
636 ASSERT_TRUE(is_installed); | 636 ASSERT_TRUE(is_installed); |
637 } | 637 } |
OLD | NEW |