| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/process_manager.h" | 5 #include "extensions/browser/process_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 #include "content/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
| 10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 ProcessManager::Create(original_context())); | 116 ProcessManager::Create(original_context())); |
| 117 | 117 |
| 118 EXPECT_EQ(original_context(), manager1->GetBrowserContext()); | 118 EXPECT_EQ(original_context(), manager1->GetBrowserContext()); |
| 119 EXPECT_EQ(0u, manager1->background_hosts().size()); | 119 EXPECT_EQ(0u, manager1->background_hosts().size()); |
| 120 | 120 |
| 121 // It observes other notifications from this context. | 121 // It observes other notifications from this context. |
| 122 EXPECT_TRUE(IsRegistered(manager1.get(), | 122 EXPECT_TRUE(IsRegistered(manager1.get(), |
| 123 chrome::NOTIFICATION_EXTENSIONS_READY, | 123 chrome::NOTIFICATION_EXTENSIONS_READY, |
| 124 original_context())); | 124 original_context())); |
| 125 EXPECT_TRUE(IsRegistered(manager1.get(), | 125 EXPECT_TRUE(IsRegistered(manager1.get(), |
| 126 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, | |
| 127 original_context())); | |
| 128 EXPECT_TRUE(IsRegistered(manager1.get(), | |
| 129 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | |
| 130 original_context())); | |
| 131 EXPECT_TRUE(IsRegistered(manager1.get(), | |
| 132 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 126 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| 133 original_context())); | 127 original_context())); |
| 134 | 128 |
| 135 // Test for an incognito context ProcessManager. | 129 // Test for an incognito context ProcessManager. |
| 136 scoped_ptr<ProcessManager> manager2(ProcessManager::CreateIncognitoForTesting( | 130 scoped_ptr<ProcessManager> manager2(ProcessManager::CreateIncognitoForTesting( |
| 137 incognito_context(), original_context(), manager1.get())); | 131 incognito_context(), original_context(), manager1.get())); |
| 138 | 132 |
| 139 EXPECT_EQ(incognito_context(), manager2->GetBrowserContext()); | 133 EXPECT_EQ(incognito_context(), manager2->GetBrowserContext()); |
| 140 EXPECT_EQ(0u, manager2->background_hosts().size()); | 134 EXPECT_EQ(0u, manager2->background_hosts().size()); |
| 141 | 135 |
| 142 // Some notifications are observed for the original context. | |
| 143 EXPECT_TRUE(IsRegistered(manager2.get(), | |
| 144 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, | |
| 145 original_context())); | |
| 146 | |
| 147 // Some notifications are observed for the incognito context. | 136 // Some notifications are observed for the incognito context. |
| 148 EXPECT_TRUE(IsRegistered(manager2.get(), | 137 EXPECT_TRUE(IsRegistered(manager2.get(), |
| 149 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 138 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| 150 incognito_context())); | 139 incognito_context())); |
| 151 | 140 |
| 152 // Some notifications are observed for both incognito and original. | 141 // Some notifications are observed for both incognito and original. |
| 153 EXPECT_TRUE(IsRegistered(manager2.get(), | 142 EXPECT_TRUE(IsRegistered(manager2.get(), |
| 154 chrome::NOTIFICATION_PROFILE_DESTROYED, | 143 chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 155 original_context())); | 144 original_context())); |
| 156 EXPECT_TRUE(IsRegistered(manager2.get(), | 145 EXPECT_TRUE(IsRegistered(manager2.get(), |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 scoped_refptr<SiteInstance> site21 = | 264 scoped_refptr<SiteInstance> site21 = |
| 276 manager1->GetSiteInstanceForURL(ext2_url1); | 265 manager1->GetSiteInstanceForURL(ext2_url1); |
| 277 EXPECT_NE(site11, site21); | 266 EXPECT_NE(site11, site21); |
| 278 | 267 |
| 279 scoped_refptr<SiteInstance> other_profile_site = | 268 scoped_refptr<SiteInstance> other_profile_site = |
| 280 manager2->GetSiteInstanceForURL(ext1_url1); | 269 manager2->GetSiteInstanceForURL(ext1_url1); |
| 281 EXPECT_NE(site11, other_profile_site); | 270 EXPECT_NE(site11, other_profile_site); |
| 282 } | 271 } |
| 283 | 272 |
| 284 } // namespace extensions | 273 } // namespace extensions |
| OLD | NEW |