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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 GURL GetTestBaseURL(const std::string& test_directory) { | 50 GURL GetTestBaseURL(const std::string& test_directory) { |
51 GURL::Replacements replace_host; | 51 GURL::Replacements replace_host; |
52 std::string host_str("localhost"); // must stay in scope with replace_host | 52 std::string host_str("localhost"); // must stay in scope with replace_host |
53 replace_host.SetHostStr(host_str); | 53 replace_host.SetHostStr(host_str); |
54 GURL base_url = embedded_test_server()->GetURL( | 54 GURL base_url = embedded_test_server()->GetURL( |
55 "/extensions/api_test/" + test_directory + "/"); | 55 "/extensions/api_test/" + test_directory + "/"); |
56 return base_url.ReplaceComponents(replace_host); | 56 return base_url.ReplaceComponents(replace_host); |
57 } | 57 } |
58 | 58 |
59 // Pass flags to make testing apps easier. | 59 // Pass flags to make testing apps easier. |
60 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 60 virtual void SetUpCommandLine(CommandLine* command_line) override { |
61 ExtensionApiTest::SetUpCommandLine(command_line); | 61 ExtensionApiTest::SetUpCommandLine(command_line); |
62 CommandLine::ForCurrentProcess()->AppendSwitch( | 62 CommandLine::ForCurrentProcess()->AppendSwitch( |
63 switches::kDisablePopupBlocking); | 63 switches::kDisablePopupBlocking); |
64 CommandLine::ForCurrentProcess()->AppendSwitch( | 64 CommandLine::ForCurrentProcess()->AppendSwitch( |
65 extensions::switches::kAllowHTTPBackgroundPage); | 65 extensions::switches::kAllowHTTPBackgroundPage); |
66 } | 66 } |
67 | 67 |
68 // Helper function to test that independent tabs of the named app are loaded | 68 // Helper function to test that independent tabs of the named app are loaded |
69 // into separate processes. | 69 // into separate processes. |
70 void TestAppInstancesHelper(const std::string& app_name) { | 70 void TestAppInstancesHelper(const std::string& app_name) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 LOG(INFO) << "WindowOpenHelper 1."; | 127 LOG(INFO) << "WindowOpenHelper 1."; |
128 OpenWindow(tab2, base_url.Resolve("path2/empty.html"), true, NULL); | 128 OpenWindow(tab2, base_url.Resolve("path2/empty.html"), true, NULL); |
129 LOG(INFO) << "End of test."; | 129 LOG(INFO) << "End of test."; |
130 UnloadExtension(extension->id()); | 130 UnloadExtension(extension->id()); |
131 } | 131 } |
132 }; | 132 }; |
133 | 133 |
134 // Omits the disable-popup-blocking flag so we can cover that case. | 134 // Omits the disable-popup-blocking flag so we can cover that case. |
135 class BlockedAppApiTest : public AppApiTest { | 135 class BlockedAppApiTest : public AppApiTest { |
136 protected: | 136 protected: |
137 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 137 virtual void SetUpCommandLine(CommandLine* command_line) override { |
138 ExtensionApiTest::SetUpCommandLine(command_line); | 138 ExtensionApiTest::SetUpCommandLine(command_line); |
139 CommandLine::ForCurrentProcess()->AppendSwitch( | 139 CommandLine::ForCurrentProcess()->AppendSwitch( |
140 extensions::switches::kAllowHTTPBackgroundPage); | 140 extensions::switches::kAllowHTTPBackgroundPage); |
141 } | 141 } |
142 }; | 142 }; |
143 | 143 |
144 // Tests that hosted apps with the background permission get a process-per-app | 144 // Tests that hosted apps with the background permission get a process-per-app |
145 // model, since all pages need to be able to script the background page. | 145 // model, since all pages need to be able to script the background page. |
146 // http://crbug.com/172750 | 146 // http://crbug.com/172750 |
147 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcess) { | 147 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcess) { |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 // Navigate the popup to another process outside the app. | 866 // Navigate the popup to another process outside the app. |
867 GURL non_app_url(base_url.Resolve("path3/empty.html")); | 867 GURL non_app_url(base_url.Resolve("path3/empty.html")); |
868 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); | 868 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); |
869 SiteInstance* new_instance = popup_contents->GetSiteInstance(); | 869 SiteInstance* new_instance = popup_contents->GetSiteInstance(); |
870 EXPECT_NE(app_instance, new_instance); | 870 EXPECT_NE(app_instance, new_instance); |
871 | 871 |
872 // It should still be in the same BrowsingInstance, allowing postMessage to | 872 // It should still be in the same BrowsingInstance, allowing postMessage to |
873 // work. | 873 // work. |
874 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); | 874 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); |
875 } | 875 } |
OLD | NEW |