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/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 // that's not in the app's extent but that redirects to it, we still end up with | 664 // that's not in the app's extent but that redirects to it, we still end up with |
665 // an app process. See http://crbug.com/99349 for more details. | 665 // an app process. See http://crbug.com/99349 for more details. |
666 IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromExtension) { | 666 IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromExtension) { |
667 host_resolver()->AddRule("*", "127.0.0.1"); | 667 host_resolver()->AddRule("*", "127.0.0.1"); |
668 ASSERT_TRUE(StartTestServer()); | 668 ASSERT_TRUE(StartTestServer()); |
669 | 669 |
670 LoadExtension(test_data_dir_.AppendASCII("app_process")); | 670 LoadExtension(test_data_dir_.AppendASCII("app_process")); |
671 const Extension* launcher = | 671 const Extension* launcher = |
672 LoadExtension(test_data_dir_.AppendASCII("app_launcher")); | 672 LoadExtension(test_data_dir_.AppendASCII("app_launcher")); |
673 | 673 |
674 // There should be three navigations by the time the app page is loaded. | 674 // There should be two navigations by the time the app page is loaded. |
675 // 1. The extension launcher page. | 675 // 1. The extension launcher page. |
676 // 2. The URL that the extension launches, which redirects. | 676 // 2. The app's URL (which includes a server redirect). |
677 // 3. The app's URL. | 677 // Note that the server redirect does not generate a navigation event. |
678 content::TestNavigationObserver test_navigation_observer( | 678 content::TestNavigationObserver test_navigation_observer( |
679 content::NotificationService::AllSources(), | 679 content::NotificationService::AllSources(), |
680 3); | 680 2); |
681 | 681 |
682 // Load the launcher extension, which should launch the app. | 682 // Load the launcher extension, which should launch the app. |
683 ui_test_utils::NavigateToURLWithDisposition( | 683 ui_test_utils::NavigateToURLWithDisposition( |
684 browser(), | 684 browser(), |
685 launcher->GetResourceURL("main.html"), | 685 launcher->GetResourceURL("main.html"), |
686 CURRENT_TAB, | 686 CURRENT_TAB, |
687 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 687 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
688 | 688 |
689 // Wait for app tab to be created and loaded. | 689 // Wait for app tab to be created and loaded. |
690 test_navigation_observer.WaitForObservation( | 690 test_navigation_observer.WaitForObservation( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 &browser()->tab_strip_model()->GetActiveWebContents()-> | 776 &browser()->tab_strip_model()->GetActiveWebContents()-> |
777 GetController())); | 777 GetController())); |
778 chrome::Reload(browser(), CURRENT_TAB); | 778 chrome::Reload(browser(), CURRENT_TAB); |
779 observer.Wait(); | 779 observer.Wait(); |
780 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 780 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
781 contents, | 781 contents, |
782 "window.domAutomationController.send(chrome.app.isInstalled)", | 782 "window.domAutomationController.send(chrome.app.isInstalled)", |
783 &is_installed)); | 783 &is_installed)); |
784 ASSERT_TRUE(is_installed); | 784 ASSERT_TRUE(is_installed); |
785 } | 785 } |
OLD | NEW |