| 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" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 208 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 209 | 209 |
| 210 ui_test_utils::NavigateToURLWithDisposition( | 210 ui_test_utils::NavigateToURLWithDisposition( |
| 211 browser(), base_url.Resolve("api_test/management/test/basics.html"), | 211 browser(), base_url.Resolve("api_test/management/test/basics.html"), |
| 212 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 212 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 213 | 213 |
| 214 std::set<int> process_ids; | 214 std::set<int> process_ids; |
| 215 Profile* profile = browser()->GetProfile(); | 215 Profile* profile = browser()->GetProfile(); |
| 216 ExtensionProcessManager* epm = profile->GetExtensionProcessManager(); | 216 ExtensionProcessManager* epm = profile->GetExtensionProcessManager(); |
| 217 | 217 |
| 218 for (ExtensionProcessManager::const_iterator iter = epm->begin(); | 218 for (ExtensionProcessManager::const_iterator iter = |
| 219 iter != epm->end(); | 219 epm->background_hosts().begin(); |
| 220 iter != epm->background_hosts().end(); |
| 220 ++iter) { | 221 ++iter) { |
| 221 ExtensionHost* host = *iter; | 222 ExtensionHost* host = *iter; |
| 222 if (host->extension()->has_background_page()) { | 223 if (host->extension()->has_background_page()) { |
| 223 process_ids.insert(host->render_process_host()->GetID()); | 224 process_ids.insert(host->render_process_host()->GetID()); |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 | 227 |
| 227 // We've loaded 5 extensions with background pages, 1 extension without | 228 // We've loaded 5 extensions with background pages, 1 extension without |
| 228 // background page, and one isolated app. We expect only 2 unique processes | 229 // background page, and one isolated app. We expect only 2 unique processes |
| 229 // hosting those extensions. | 230 // hosting those extensions. |
| 230 EXPECT_GE((size_t) 6, profile->GetExtensionService()->process_map()->size()); | 231 EXPECT_GE((size_t) 6, profile->GetExtensionService()->process_map()->size()); |
| 231 EXPECT_EQ((size_t) 2, process_ids.size()); | 232 EXPECT_EQ((size_t) 2, process_ids.size()); |
| 232 } | 233 } |
| OLD | NEW |