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 "content/public/browser/content_browser_client.h" | 7 #include "content/public/browser/content_browser_client.h" |
8 #include "content/public/browser/notification_service.h" | 8 #include "content/public/browser/notification_service.h" |
9 #include "content/public/browser/site_instance.h" | 9 #include "content/public/browser/site_instance.h" |
10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 original_context(), extension_registry())); | 104 original_context(), extension_registry())); |
105 | 105 |
106 EXPECT_EQ(original_context(), manager1->GetBrowserContext()); | 106 EXPECT_EQ(original_context(), manager1->GetBrowserContext()); |
107 EXPECT_EQ(0u, manager1->background_hosts().size()); | 107 EXPECT_EQ(0u, manager1->background_hosts().size()); |
108 | 108 |
109 // It observes other notifications from this context. | 109 // It observes other notifications from this context. |
110 EXPECT_TRUE(IsRegistered(manager1.get(), | 110 EXPECT_TRUE(IsRegistered(manager1.get(), |
111 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, | 111 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, |
112 original_context())); | 112 original_context())); |
113 EXPECT_TRUE(IsRegistered(manager1.get(), | 113 EXPECT_TRUE(IsRegistered(manager1.get(), |
| 114 extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 115 original_context())); |
| 116 EXPECT_TRUE( |
| 117 IsRegistered(manager1.get(), |
| 118 extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 119 original_context())); |
| 120 EXPECT_TRUE(IsRegistered(manager1.get(), |
114 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 121 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
115 original_context())); | 122 original_context())); |
116 | 123 |
117 // Test for an incognito context ProcessManager. | 124 // Test for an incognito context ProcessManager. |
118 scoped_ptr<ProcessManager> manager2( | 125 scoped_ptr<ProcessManager> manager2( |
119 ProcessManager::CreateIncognitoForTesting(incognito_context(), | 126 ProcessManager::CreateIncognitoForTesting(incognito_context(), |
120 original_context(), | 127 original_context(), |
121 manager1.get(), | 128 manager1.get(), |
122 extension_registry())); | 129 extension_registry())); |
123 | 130 |
124 EXPECT_EQ(incognito_context(), manager2->GetBrowserContext()); | 131 EXPECT_EQ(incognito_context(), manager2->GetBrowserContext()); |
125 EXPECT_EQ(0u, manager2->background_hosts().size()); | 132 EXPECT_EQ(0u, manager2->background_hosts().size()); |
126 | 133 |
| 134 // Some notifications are observed for the original context. |
| 135 EXPECT_TRUE(IsRegistered(manager2.get(), |
| 136 extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 137 original_context())); |
| 138 |
127 // Some notifications are observed for the incognito context. | 139 // Some notifications are observed for the incognito context. |
128 EXPECT_TRUE(IsRegistered(manager2.get(), | 140 EXPECT_TRUE(IsRegistered(manager2.get(), |
129 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 141 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
130 incognito_context())); | 142 incognito_context())); |
131 | 143 |
132 // Some are not observed at all. | 144 // Some are not observed at all. |
133 EXPECT_FALSE( | 145 EXPECT_FALSE( |
134 IsRegistered(manager2.get(), | 146 IsRegistered(manager2.get(), |
135 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, | 147 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, |
136 original_context())); | 148 original_context())); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 scoped_refptr<SiteInstance> site21 = | 254 scoped_refptr<SiteInstance> site21 = |
243 manager1->GetSiteInstanceForURL(ext2_url1); | 255 manager1->GetSiteInstanceForURL(ext2_url1); |
244 EXPECT_NE(site11, site21); | 256 EXPECT_NE(site11, site21); |
245 | 257 |
246 scoped_refptr<SiteInstance> other_profile_site = | 258 scoped_refptr<SiteInstance> other_profile_site = |
247 manager2->GetSiteInstanceForURL(ext1_url1); | 259 manager2->GetSiteInstanceForURL(ext1_url1); |
248 EXPECT_NE(site11, other_profile_site); | 260 EXPECT_NE(site11, other_profile_site); |
249 } | 261 } |
250 | 262 |
251 } // namespace extensions | 263 } // namespace extensions |
OLD | NEW |