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 "content/public/browser/content_browser_client.h" | 8 #include "content/public/browser/content_browser_client.h" |
9 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
10 #include "content/public/browser/site_instance.h" | 10 #include "content/public/browser/site_instance.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Some notifications are observed for the original context. | 162 // Some notifications are observed for the original context. |
163 EXPECT_TRUE(IsRegistered(manager2.get(), | 163 EXPECT_TRUE(IsRegistered(manager2.get(), |
164 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, | 164 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
165 original_context())); | 165 original_context())); |
166 | 166 |
167 // Some notifications are observed for the incognito context. | 167 // Some notifications are observed for the incognito context. |
168 EXPECT_TRUE(IsRegistered(manager2.get(), | 168 EXPECT_TRUE(IsRegistered(manager2.get(), |
169 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 169 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
170 incognito_context())); | 170 incognito_context())); |
171 | 171 |
172 // Some notifications are observed for both incognito and original. | |
173 EXPECT_TRUE(IsRegistered(manager2.get(), | |
174 chrome::NOTIFICATION_PROFILE_DESTROYED, | |
175 original_context())); | |
176 EXPECT_TRUE(IsRegistered(manager2.get(), | |
177 chrome::NOTIFICATION_PROFILE_DESTROYED, | |
178 incognito_context())); | |
179 | |
180 // Some are not observed at all. | 172 // Some are not observed at all. |
181 EXPECT_FALSE(IsRegistered(manager2.get(), | 173 EXPECT_FALSE(IsRegistered(manager2.get(), |
182 chrome::NOTIFICATION_EXTENSIONS_READY, | 174 chrome::NOTIFICATION_EXTENSIONS_READY, |
183 original_context())); | 175 original_context())); |
184 | |
185 // This notification is observed for incognito contexts only. | |
186 EXPECT_TRUE(IsRegistered(manager2.get(), | |
187 chrome::NOTIFICATION_PROFILE_DESTROYED, | |
188 incognito_context())); | |
189 } | 176 } |
190 | 177 |
191 // Test that startup background hosts are created when the extension system | 178 // Test that startup background hosts are created when the extension system |
192 // becomes ready. | 179 // becomes ready. |
193 // | 180 // |
194 // NOTE: This test and those that follow do not try to create ExtensionsHosts | 181 // NOTE: This test and those that follow do not try to create ExtensionsHosts |
195 // because ExtensionHost is tightly coupled to WebContents and can't be | 182 // because ExtensionHost is tightly coupled to WebContents and can't be |
196 // constructed in unit tests. | 183 // constructed in unit tests. |
197 TEST_F(ProcessManagerTest, CreateBackgroundHostsOnExtensionsReady) { | 184 TEST_F(ProcessManagerTest, CreateBackgroundHostsOnExtensionsReady) { |
198 scoped_ptr<ProcessManager> manager(ProcessManager::CreateForTesting( | 185 scoped_ptr<ProcessManager> manager(ProcessManager::CreateForTesting( |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 scoped_refptr<SiteInstance> site21 = | 281 scoped_refptr<SiteInstance> site21 = |
295 manager1->GetSiteInstanceForURL(ext2_url1); | 282 manager1->GetSiteInstanceForURL(ext2_url1); |
296 EXPECT_NE(site11, site21); | 283 EXPECT_NE(site11, site21); |
297 | 284 |
298 scoped_refptr<SiteInstance> other_profile_site = | 285 scoped_refptr<SiteInstance> other_profile_site = |
299 manager2->GetSiteInstanceForURL(ext1_url1); | 286 manager2->GetSiteInstanceForURL(ext1_url1); |
300 EXPECT_NE(site11, other_profile_site); | 287 EXPECT_NE(site11, other_profile_site); |
301 } | 288 } |
302 | 289 |
303 } // namespace extensions | 290 } // namespace extensions |
OLD | NEW |