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/automation/automation_util.h" | 6 #include "chrome/browser/automation/automation_util.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/extensions/extension_process_manager.h" | 9 #include "chrome/browser/extensions/extension_process_manager.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_system.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
19 #include "content/public/browser/render_process_host.h" | 20 #include "content/public/browser/render_process_host.h" |
20 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 content::RenderProcessHost* hosted2_host = | 126 content::RenderProcessHost* hosted2_host = |
126 chrome::GetWebContentsAt(browser(), 6)->GetRenderProcessHost(); | 127 chrome::GetWebContentsAt(browser(), 6)->GetRenderProcessHost(); |
127 content::RenderProcessHost* web2_host = | 128 content::RenderProcessHost* web2_host = |
128 chrome::GetWebContentsAt(browser(), 7)->GetRenderProcessHost(); | 129 chrome::GetWebContentsAt(browser(), 7)->GetRenderProcessHost(); |
129 | 130 |
130 content::RenderProcessHost* second_isolated1_host = | 131 content::RenderProcessHost* second_isolated1_host = |
131 chrome::GetWebContentsAt(browser(), 8)->GetRenderProcessHost(); | 132 chrome::GetWebContentsAt(browser(), 8)->GetRenderProcessHost(); |
132 | 133 |
133 // Get extension processes. | 134 // Get extension processes. |
134 ExtensionProcessManager* process_manager = | 135 ExtensionProcessManager* process_manager = |
135 browser()->profile()->GetExtensionProcessManager(); | 136 extensions::ExtensionSystem::Get(browser()->profile())-> |
| 137 process_manager(); |
136 content::RenderProcessHost* extension1_host = | 138 content::RenderProcessHost* extension1_host = |
137 process_manager->GetSiteInstanceForURL(extension1_url)->GetProcess(); | 139 process_manager->GetSiteInstanceForURL(extension1_url)->GetProcess(); |
138 content::RenderProcessHost* extension2_host = | 140 content::RenderProcessHost* extension2_host = |
139 process_manager->GetSiteInstanceForURL(extension2_url)->GetProcess(); | 141 process_manager->GetSiteInstanceForURL(extension2_url)->GetProcess(); |
140 | 142 |
141 // An isolated app only shares with other instances of itself, not other | 143 // An isolated app only shares with other instances of itself, not other |
142 // isolated apps or anything else. | 144 // isolated apps or anything else. |
143 EXPECT_EQ(isolated1_host, second_isolated1_host); | 145 EXPECT_EQ(isolated1_host, second_isolated1_host); |
144 EXPECT_NE(isolated1_host, isolated2_host); | 146 EXPECT_NE(isolated1_host, isolated2_host); |
145 EXPECT_NE(isolated1_host, ntp1_host); | 147 EXPECT_NE(isolated1_host, ntp1_host); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 ui_test_utils::NavigateToURLWithDisposition( | 211 ui_test_utils::NavigateToURLWithDisposition( |
210 browser(), base_url.Resolve("isolated_apps/app1/main.html"), | 212 browser(), base_url.Resolve("isolated_apps/app1/main.html"), |
211 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 213 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
212 | 214 |
213 ui_test_utils::NavigateToURLWithDisposition( | 215 ui_test_utils::NavigateToURLWithDisposition( |
214 browser(), base_url.Resolve("api_test/management/test/basics.html"), | 216 browser(), base_url.Resolve("api_test/management/test/basics.html"), |
215 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 217 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
216 | 218 |
217 std::set<int> process_ids; | 219 std::set<int> process_ids; |
218 Profile* profile = browser()->profile(); | 220 Profile* profile = browser()->profile(); |
219 ExtensionProcessManager* epm = profile->GetExtensionProcessManager(); | 221 ExtensionProcessManager* epm = extensions::ExtensionSystem::Get(profile)-> |
220 | 222 process_manager(); |
221 for (ExtensionProcessManager::const_iterator iter = | 223 for (ExtensionProcessManager::const_iterator iter = |
222 epm->background_hosts().begin(); | 224 epm->background_hosts().begin(); |
223 iter != epm->background_hosts().end(); ++iter) { | 225 iter != epm->background_hosts().end(); ++iter) { |
224 process_ids.insert((*iter)->render_process_host()->GetID()); | 226 process_ids.insert((*iter)->render_process_host()->GetID()); |
225 } | 227 } |
226 | 228 |
227 // We've loaded 5 extensions with background pages, 1 extension without | 229 // We've loaded 5 extensions with background pages, 1 extension without |
228 // background page, and one isolated app. We expect only 2 unique processes | 230 // background page, and one isolated app. We expect only 2 unique processes |
229 // hosting those extensions. | 231 // hosting those extensions. |
230 EXPECT_GE((size_t) 6, profile->GetExtensionService()->process_map()->size()); | 232 EXPECT_GE((size_t) 6, profile->GetExtensionService()->process_map()->size()); |
231 EXPECT_EQ((size_t) 2, process_ids.size()); | 233 EXPECT_EQ((size_t) 2, process_ids.size()); |
232 } | 234 } |
OLD | NEW |