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_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 10 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // Helper function to test that independent tabs of the named app are loaded | 67 // Helper function to test that independent tabs of the named app are loaded |
68 // into separate processes. | 68 // into separate processes. |
69 void TestAppInstancesHelper(const std::string& app_name) { | 69 void TestAppInstancesHelper(const std::string& app_name) { |
70 LOG(INFO) << "Start of test."; | 70 LOG(INFO) << "Start of test."; |
71 | 71 |
72 extensions::ProcessMap* process_map = | 72 extensions::ProcessMap* process_map = |
73 extensions::ProcessMap::Get(browser()->profile()); | 73 extensions::ProcessMap::Get(browser()->profile()); |
74 | 74 |
75 host_resolver()->AddRule("*", "127.0.0.1"); | 75 host_resolver()->AddRule("*", "127.0.0.1"); |
76 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 76 ASSERT_TRUE(embedded_test_server()->Start()); |
77 | 77 |
78 ASSERT_TRUE(LoadExtension( | 78 ASSERT_TRUE(LoadExtension( |
79 test_data_dir_.AppendASCII(app_name))); | 79 test_data_dir_.AppendASCII(app_name))); |
80 const Extension* extension = GetSingleLoadedExtension(); | 80 const Extension* extension = GetSingleLoadedExtension(); |
81 | 81 |
82 // Open two tabs in the app, one outside it. | 82 // Open two tabs in the app, one outside it. |
83 GURL base_url = GetTestBaseURL(app_name); | 83 GURL base_url = GetTestBaseURL(app_name); |
84 | 84 |
85 // Test both opening a URL in a new tab, and opening a tab and then | 85 // Test both opening a URL in a new tab, and opening a tab and then |
86 // navigating it. Either way, app tabs should be considered extension | 86 // navigating it. Either way, app tabs should be considered extension |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Tests that hosted apps with the background permission get a process-per-app | 143 // Tests that hosted apps with the background permission get a process-per-app |
144 // model, since all pages need to be able to script the background page. | 144 // model, since all pages need to be able to script the background page. |
145 // http://crbug.com/172750 | 145 // http://crbug.com/172750 |
146 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcess) { | 146 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcess) { |
147 LOG(INFO) << "Start of test."; | 147 LOG(INFO) << "Start of test."; |
148 | 148 |
149 extensions::ProcessMap* process_map = | 149 extensions::ProcessMap* process_map = |
150 extensions::ProcessMap::Get(browser()->profile()); | 150 extensions::ProcessMap::Get(browser()->profile()); |
151 | 151 |
152 host_resolver()->AddRule("*", "127.0.0.1"); | 152 host_resolver()->AddRule("*", "127.0.0.1"); |
153 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 153 ASSERT_TRUE(embedded_test_server()->Start()); |
154 | 154 |
155 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); | 155 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); |
156 | 156 |
157 LOG(INFO) << "Loaded extension."; | 157 LOG(INFO) << "Loaded extension."; |
158 | 158 |
159 // Open two tabs in the app, one outside it. | 159 // Open two tabs in the app, one outside it. |
160 GURL base_url = GetTestBaseURL("app_process"); | 160 GURL base_url = GetTestBaseURL("app_process"); |
161 | 161 |
162 // Test both opening a URL in a new tab, and opening a tab and then navigating | 162 // Test both opening a URL in a new tab, and opening a tab and then navigating |
163 // it. Either way, app tabs should be considered extension processes, but | 163 // it. Either way, app tabs should be considered extension processes, but |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 #else | 291 #else |
292 #define MAYBE_BookmarkAppGetsNormalProcess BookmarkAppGetsNormalProcess | 292 #define MAYBE_BookmarkAppGetsNormalProcess BookmarkAppGetsNormalProcess |
293 #endif | 293 #endif |
294 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_BookmarkAppGetsNormalProcess) { | 294 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_BookmarkAppGetsNormalProcess) { |
295 ExtensionService* service = extensions::ExtensionSystem::Get( | 295 ExtensionService* service = extensions::ExtensionSystem::Get( |
296 browser()->profile())->extension_service(); | 296 browser()->profile())->extension_service(); |
297 extensions::ProcessMap* process_map = | 297 extensions::ProcessMap* process_map = |
298 extensions::ProcessMap::Get(browser()->profile()); | 298 extensions::ProcessMap::Get(browser()->profile()); |
299 | 299 |
300 host_resolver()->AddRule("*", "127.0.0.1"); | 300 host_resolver()->AddRule("*", "127.0.0.1"); |
301 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 301 ASSERT_TRUE(embedded_test_server()->Start()); |
302 GURL base_url = GetTestBaseURL("app_process"); | 302 GURL base_url = GetTestBaseURL("app_process"); |
303 | 303 |
304 // Load an app as a bookmark app. | 304 // Load an app as a bookmark app. |
305 std::string error; | 305 std::string error; |
306 scoped_refptr<const Extension> extension(extensions::file_util::LoadExtension( | 306 scoped_refptr<const Extension> extension(extensions::file_util::LoadExtension( |
307 test_data_dir_.AppendASCII("app_process"), | 307 test_data_dir_.AppendASCII("app_process"), |
308 extensions::Manifest::UNPACKED, | 308 extensions::Manifest::UNPACKED, |
309 Extension::FROM_BOOKMARK, | 309 Extension::FROM_BOOKMARK, |
310 &error)); | 310 &error)); |
311 service->OnExtensionInstalled(extension.get(), | 311 service->OnExtensionInstalled(extension.get(), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 // Tests that app process switching works properly in the following scenario: | 372 // Tests that app process switching works properly in the following scenario: |
373 // 1. navigate to a page1 in the app | 373 // 1. navigate to a page1 in the app |
374 // 2. page1 redirects to a page2 outside the app extent (ie, "/server-redirect") | 374 // 2. page1 redirects to a page2 outside the app extent (ie, "/server-redirect") |
375 // 3. page2 redirects back to a page in the app | 375 // 3. page2 redirects back to a page in the app |
376 // The final navigation should end up in the app process. | 376 // The final navigation should end up in the app process. |
377 // See http://crbug.com/61757 | 377 // See http://crbug.com/61757 |
378 // Flaky. http://crbug.com/341898 | 378 // Flaky. http://crbug.com/341898 |
379 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcessRedirectBack) { | 379 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcessRedirectBack) { |
380 host_resolver()->AddRule("*", "127.0.0.1"); | 380 host_resolver()->AddRule("*", "127.0.0.1"); |
381 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 381 ASSERT_TRUE(embedded_test_server()->Start()); |
382 | 382 |
383 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); | 383 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); |
384 | 384 |
385 // Open two tabs in the app. | 385 // Open two tabs in the app. |
386 GURL base_url = GetTestBaseURL("app_process"); | 386 GURL base_url = GetTestBaseURL("app_process"); |
387 | 387 |
388 chrome::NewTab(browser()); | 388 chrome::NewTab(browser()); |
389 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); | 389 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); |
390 chrome::NewTab(browser()); | 390 chrome::NewTab(browser()); |
391 // Wait until the second tab finishes its redirect train (2 hops). | 391 // Wait until the second tab finishes its redirect train (2 hops). |
(...skipping 24 matching lines...) Expand all Loading... |
416 // Ensure that re-navigating to a URL after installing or uninstalling it as an | 416 // Ensure that re-navigating to a URL after installing or uninstalling it as an |
417 // app correctly swaps the tab to the app process. (http://crbug.com/80621) | 417 // app correctly swaps the tab to the app process. (http://crbug.com/80621) |
418 // | 418 // |
419 // Fails on Windows. http://crbug.com/238670 | 419 // Fails on Windows. http://crbug.com/238670 |
420 // Added logging to help diagnose the location of the problem. | 420 // Added logging to help diagnose the location of the problem. |
421 IN_PROC_BROWSER_TEST_F(AppApiTest, NavigateIntoAppProcess) { | 421 IN_PROC_BROWSER_TEST_F(AppApiTest, NavigateIntoAppProcess) { |
422 extensions::ProcessMap* process_map = | 422 extensions::ProcessMap* process_map = |
423 extensions::ProcessMap::Get(browser()->profile()); | 423 extensions::ProcessMap::Get(browser()->profile()); |
424 | 424 |
425 host_resolver()->AddRule("*", "127.0.0.1"); | 425 host_resolver()->AddRule("*", "127.0.0.1"); |
426 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 426 ASSERT_TRUE(embedded_test_server()->Start()); |
427 | 427 |
428 // The app under test acts on URLs whose host is "localhost", | 428 // The app under test acts on URLs whose host is "localhost", |
429 // so the URLs we navigate to must have host "localhost". | 429 // so the URLs we navigate to must have host "localhost". |
430 GURL base_url = GetTestBaseURL("app_process"); | 430 GURL base_url = GetTestBaseURL("app_process"); |
431 | 431 |
432 // Load an app URL before loading the app. | 432 // Load an app URL before loading the app. |
433 LOG(INFO) << "Loading path1/empty.html."; | 433 LOG(INFO) << "Loading path1/empty.html."; |
434 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); | 434 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); |
435 LOG(INFO) << "Loading path1/empty.html - done."; | 435 LOG(INFO) << "Loading path1/empty.html - done."; |
436 WebContents* contents = browser()->tab_strip_model()->GetWebContentsAt(0); | 436 WebContents* contents = browser()->tab_strip_model()->GetWebContentsAt(0); |
(...skipping 26 matching lines...) Expand all Loading... |
463 // Ensure that reloading a URL after installing or uninstalling it as an app | 463 // Ensure that reloading a URL after installing or uninstalling it as an app |
464 // correctly swaps the tab to the app process. (http://crbug.com/80621) | 464 // correctly swaps the tab to the app process. (http://crbug.com/80621) |
465 // | 465 // |
466 // Added logging to help diagnose the location of the problem. | 466 // Added logging to help diagnose the location of the problem. |
467 // http://crbug.com/238670 | 467 // http://crbug.com/238670 |
468 IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcess) { | 468 IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcess) { |
469 extensions::ProcessMap* process_map = | 469 extensions::ProcessMap* process_map = |
470 extensions::ProcessMap::Get(browser()->profile()); | 470 extensions::ProcessMap::Get(browser()->profile()); |
471 | 471 |
472 host_resolver()->AddRule("*", "127.0.0.1"); | 472 host_resolver()->AddRule("*", "127.0.0.1"); |
473 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 473 ASSERT_TRUE(embedded_test_server()->Start()); |
474 | 474 |
475 // The app under test acts on URLs whose host is "localhost", | 475 // The app under test acts on URLs whose host is "localhost", |
476 // so the URLs we navigate to must have host "localhost". | 476 // so the URLs we navigate to must have host "localhost". |
477 GURL base_url = GetTestBaseURL("app_process"); | 477 GURL base_url = GetTestBaseURL("app_process"); |
478 | 478 |
479 // Load app, disable it, and navigate to the page. | 479 // Load app, disable it, and navigate to the page. |
480 LOG(INFO) << "Loading extension."; | 480 LOG(INFO) << "Loading extension."; |
481 const Extension* app = | 481 const Extension* app = |
482 LoadExtension(test_data_dir_.AppendASCII("app_process")); | 482 LoadExtension(test_data_dir_.AppendASCII("app_process")); |
483 LOG(INFO) << "Loading extension - done."; | 483 LOG(INFO) << "Loading extension - done."; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // Ensure that reloading a URL with JavaScript after installing or uninstalling | 528 // Ensure that reloading a URL with JavaScript after installing or uninstalling |
529 // it as an app correctly swaps the process. (http://crbug.com/80621) | 529 // it as an app correctly swaps the process. (http://crbug.com/80621) |
530 // | 530 // |
531 // Crashes on Windows and Mac. http://crbug.com/238670 | 531 // Crashes on Windows and Mac. http://crbug.com/238670 |
532 // Added logging to help diagnose the location of the problem. | 532 // Added logging to help diagnose the location of the problem. |
533 IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcessWithJavaScript) { | 533 IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcessWithJavaScript) { |
534 extensions::ProcessMap* process_map = | 534 extensions::ProcessMap* process_map = |
535 extensions::ProcessMap::Get(browser()->profile()); | 535 extensions::ProcessMap::Get(browser()->profile()); |
536 | 536 |
537 host_resolver()->AddRule("*", "127.0.0.1"); | 537 host_resolver()->AddRule("*", "127.0.0.1"); |
538 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 538 ASSERT_TRUE(embedded_test_server()->Start()); |
539 | 539 |
540 // The app under test acts on URLs whose host is "localhost", | 540 // The app under test acts on URLs whose host is "localhost", |
541 // so the URLs we navigate to must have host "localhost". | 541 // so the URLs we navigate to must have host "localhost". |
542 GURL base_url = GetTestBaseURL("app_process"); | 542 GURL base_url = GetTestBaseURL("app_process"); |
543 | 543 |
544 // Load app, disable it, and navigate to the page. | 544 // Load app, disable it, and navigate to the page. |
545 LOG(INFO) << "Loading extension."; | 545 LOG(INFO) << "Loading extension."; |
546 const Extension* app = | 546 const Extension* app = |
547 LoadExtension(test_data_dir_.AppendASCII("app_process")); | 547 LoadExtension(test_data_dir_.AppendASCII("app_process")); |
548 LOG(INFO) << "Loading extension - done."; | 548 LOG(INFO) << "Loading extension - done."; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 600 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
601 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 601 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
602 switches::kAshBrowserTests)) | 602 switches::kAshBrowserTests)) |
603 return; | 603 return; |
604 #endif | 604 #endif |
605 | 605 |
606 extensions::ProcessMap* process_map = | 606 extensions::ProcessMap* process_map = |
607 extensions::ProcessMap::Get(browser()->profile()); | 607 extensions::ProcessMap::Get(browser()->profile()); |
608 | 608 |
609 host_resolver()->AddRule("*", "127.0.0.1"); | 609 host_resolver()->AddRule("*", "127.0.0.1"); |
610 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 610 ASSERT_TRUE(embedded_test_server()->Start()); |
611 | 611 |
612 GURL base_url = GetTestBaseURL("app_process"); | 612 GURL base_url = GetTestBaseURL("app_process"); |
613 | 613 |
614 // Load app and start URL (not in the app). | 614 // Load app and start URL (not in the app). |
615 const Extension* app = | 615 const Extension* app = |
616 LoadExtension(test_data_dir_.AppendASCII("app_process")); | 616 LoadExtension(test_data_dir_.AppendASCII("app_process")); |
617 ASSERT_TRUE(app); | 617 ASSERT_TRUE(app); |
618 | 618 |
619 ui_test_utils::NavigateToURL(browser(), | 619 ui_test_utils::NavigateToURL(browser(), |
620 base_url.Resolve("path3/container.html")); | 620 base_url.Resolve("path3/container.html")); |
(...skipping 16 matching lines...) Expand all Loading... |
637 // Similar to the previous test, but ensure that popup blocking bypass | 637 // Similar to the previous test, but ensure that popup blocking bypass |
638 // isn't granted to the iframe. See crbug.com/117446. | 638 // isn't granted to the iframe. See crbug.com/117446. |
639 #if defined(OS_CHROMEOS) | 639 #if defined(OS_CHROMEOS) |
640 // http://crbug.com/153513 | 640 // http://crbug.com/153513 |
641 #define MAYBE_OpenAppFromIframe DISABLED_OpenAppFromIframe | 641 #define MAYBE_OpenAppFromIframe DISABLED_OpenAppFromIframe |
642 #else | 642 #else |
643 #define MAYBE_OpenAppFromIframe OpenAppFromIframe | 643 #define MAYBE_OpenAppFromIframe OpenAppFromIframe |
644 #endif | 644 #endif |
645 IN_PROC_BROWSER_TEST_F(BlockedAppApiTest, MAYBE_OpenAppFromIframe) { | 645 IN_PROC_BROWSER_TEST_F(BlockedAppApiTest, MAYBE_OpenAppFromIframe) { |
646 host_resolver()->AddRule("*", "127.0.0.1"); | 646 host_resolver()->AddRule("*", "127.0.0.1"); |
647 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 647 ASSERT_TRUE(embedded_test_server()->Start()); |
648 | 648 |
649 // Load app and start URL (not in the app). | 649 // Load app and start URL (not in the app). |
650 const Extension* app = | 650 const Extension* app = |
651 LoadExtension(test_data_dir_.AppendASCII("app_process")); | 651 LoadExtension(test_data_dir_.AppendASCII("app_process")); |
652 ASSERT_TRUE(app); | 652 ASSERT_TRUE(app); |
653 | 653 |
654 ui_test_utils::NavigateToURL( | 654 ui_test_utils::NavigateToURL( |
655 browser(), GetTestBaseURL("app_process").Resolve("path3/container.html")); | 655 browser(), GetTestBaseURL("app_process").Resolve("path3/container.html")); |
656 | 656 |
657 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 657 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 // window to a same-origin non-app URL (path3/empty.html) should keep the window | 744 // window to a same-origin non-app URL (path3/empty.html) should keep the window |
745 // in the app process. | 745 // in the app process. |
746 // This is in contrast to OpenAppFromIframe, since here the popup will not be | 746 // This is in contrast to OpenAppFromIframe, since here the popup will not be |
747 // missing special permissions and should be scriptable from the iframe. | 747 // missing special permissions and should be scriptable from the iframe. |
748 // See http://crbug.com/92669 for more details. | 748 // See http://crbug.com/92669 for more details. |
749 IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { | 749 IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { |
750 extensions::ProcessMap* process_map = | 750 extensions::ProcessMap* process_map = |
751 extensions::ProcessMap::Get(browser()->profile()); | 751 extensions::ProcessMap::Get(browser()->profile()); |
752 | 752 |
753 host_resolver()->AddRule("*", "127.0.0.1"); | 753 host_resolver()->AddRule("*", "127.0.0.1"); |
754 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 754 ASSERT_TRUE(embedded_test_server()->Start()); |
755 | 755 |
756 GURL base_url = GetTestBaseURL("app_process"); | 756 GURL base_url = GetTestBaseURL("app_process"); |
757 | 757 |
758 // Load app and start URL (in the app). | 758 // Load app and start URL (in the app). |
759 const Extension* app = | 759 const Extension* app = |
760 LoadExtension(test_data_dir_.AppendASCII("app_process")); | 760 LoadExtension(test_data_dir_.AppendASCII("app_process")); |
761 ASSERT_TRUE(app); | 761 ASSERT_TRUE(app); |
762 | 762 |
763 ui_test_utils::NavigateToURL(browser(), | 763 ui_test_utils::NavigateToURL(browser(), |
764 base_url.Resolve("path1/container.html")); | 764 base_url.Resolve("path1/container.html")); |
(...skipping 22 matching lines...) Expand all Loading... |
787 #if defined(OS_MACOSX) || defined(OS_LINUX) | 787 #if defined(OS_MACOSX) || defined(OS_LINUX) |
788 #define MAYBE_ReloadAppAfterCrash DISABLED_ReloadAppAfterCrash | 788 #define MAYBE_ReloadAppAfterCrash DISABLED_ReloadAppAfterCrash |
789 #else | 789 #else |
790 #define MAYBE_ReloadAppAfterCrash ReloadAppAfterCrash | 790 #define MAYBE_ReloadAppAfterCrash ReloadAppAfterCrash |
791 #endif | 791 #endif |
792 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadAppAfterCrash) { | 792 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadAppAfterCrash) { |
793 extensions::ProcessMap* process_map = | 793 extensions::ProcessMap* process_map = |
794 extensions::ProcessMap::Get(browser()->profile()); | 794 extensions::ProcessMap::Get(browser()->profile()); |
795 | 795 |
796 host_resolver()->AddRule("*", "127.0.0.1"); | 796 host_resolver()->AddRule("*", "127.0.0.1"); |
797 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 797 ASSERT_TRUE(embedded_test_server()->Start()); |
798 | 798 |
799 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); | 799 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); |
800 | 800 |
801 GURL base_url = GetTestBaseURL("app_process"); | 801 GURL base_url = GetTestBaseURL("app_process"); |
802 | 802 |
803 // Load the app, chrome.app.isInstalled should be true. | 803 // Load the app, chrome.app.isInstalled should be true. |
804 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); | 804 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); |
805 WebContents* contents = browser()->tab_strip_model()->GetWebContentsAt(0); | 805 WebContents* contents = browser()->tab_strip_model()->GetWebContentsAt(0); |
806 EXPECT_TRUE(process_map->Contains( | 806 EXPECT_TRUE(process_map->Contains( |
807 contents->GetRenderProcessHost()->GetID())); | 807 contents->GetRenderProcessHost()->GetID())); |
(...skipping 21 matching lines...) Expand all Loading... |
829 } | 829 } |
830 | 830 |
831 // Test that a cross-process navigation away from a hosted app stays in the same | 831 // Test that a cross-process navigation away from a hosted app stays in the same |
832 // BrowsingInstance, so that postMessage calls to the app's other windows still | 832 // BrowsingInstance, so that postMessage calls to the app's other windows still |
833 // work. | 833 // work. |
834 IN_PROC_BROWSER_TEST_F(AppApiTest, SameBrowsingInstanceAfterSwap) { | 834 IN_PROC_BROWSER_TEST_F(AppApiTest, SameBrowsingInstanceAfterSwap) { |
835 extensions::ProcessMap* process_map = | 835 extensions::ProcessMap* process_map = |
836 extensions::ProcessMap::Get(browser()->profile()); | 836 extensions::ProcessMap::Get(browser()->profile()); |
837 | 837 |
838 host_resolver()->AddRule("*", "127.0.0.1"); | 838 host_resolver()->AddRule("*", "127.0.0.1"); |
839 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 839 ASSERT_TRUE(embedded_test_server()->Start()); |
840 | 840 |
841 GURL base_url = GetTestBaseURL("app_process"); | 841 GURL base_url = GetTestBaseURL("app_process"); |
842 | 842 |
843 // Load app and start URL (in the app). | 843 // Load app and start URL (in the app). |
844 const Extension* app = | 844 const Extension* app = |
845 LoadExtension(test_data_dir_.AppendASCII("app_process")); | 845 LoadExtension(test_data_dir_.AppendASCII("app_process")); |
846 ASSERT_TRUE(app); | 846 ASSERT_TRUE(app); |
847 | 847 |
848 ui_test_utils::NavigateToURL(browser(), | 848 ui_test_utils::NavigateToURL(browser(), |
849 base_url.Resolve("path1/iframe.html")); | 849 base_url.Resolve("path1/iframe.html")); |
(...skipping 15 matching lines...) Expand all Loading... |
865 // Navigate the popup to another process outside the app. | 865 // Navigate the popup to another process outside the app. |
866 GURL non_app_url(base_url.Resolve("path3/empty.html")); | 866 GURL non_app_url(base_url.Resolve("path3/empty.html")); |
867 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); | 867 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); |
868 SiteInstance* new_instance = popup_contents->GetSiteInstance(); | 868 SiteInstance* new_instance = popup_contents->GetSiteInstance(); |
869 EXPECT_NE(app_instance, new_instance); | 869 EXPECT_NE(app_instance, new_instance); |
870 | 870 |
871 // It should still be in the same BrowsingInstance, allowing postMessage to | 871 // It should still be in the same BrowsingInstance, allowing postMessage to |
872 // work. | 872 // work. |
873 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); | 873 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); |
874 } | 874 } |
OLD | NEW |