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(), | |
121 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 114 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
122 original_context())); | 115 original_context())); |
123 | 116 |
124 // Test for an incognito context ProcessManager. | 117 // Test for an incognito context ProcessManager. |
125 scoped_ptr<ProcessManager> manager2( | 118 scoped_ptr<ProcessManager> manager2( |
126 ProcessManager::CreateIncognitoForTesting(incognito_context(), | 119 ProcessManager::CreateIncognitoForTesting(incognito_context(), |
127 original_context(), | 120 original_context(), |
128 manager1.get(), | 121 manager1.get(), |
129 extension_registry())); | 122 extension_registry())); |
130 | 123 |
131 EXPECT_EQ(incognito_context(), manager2->GetBrowserContext()); | 124 EXPECT_EQ(incognito_context(), manager2->GetBrowserContext()); |
132 EXPECT_EQ(0u, manager2->background_hosts().size()); | 125 EXPECT_EQ(0u, manager2->background_hosts().size()); |
133 | 126 |
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 | |
139 // Some notifications are observed for the incognito context. | 127 // Some notifications are observed for the incognito context. |
140 EXPECT_TRUE(IsRegistered(manager2.get(), | 128 EXPECT_TRUE(IsRegistered(manager2.get(), |
141 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 129 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
142 incognito_context())); | 130 incognito_context())); |
143 | 131 |
144 // Some are not observed at all. | 132 // Some are not observed at all. |
145 EXPECT_FALSE( | 133 EXPECT_FALSE( |
146 IsRegistered(manager2.get(), | 134 IsRegistered(manager2.get(), |
147 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, | 135 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, |
148 original_context())); | 136 original_context())); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 scoped_refptr<SiteInstance> site21 = | 242 scoped_refptr<SiteInstance> site21 = |
255 manager1->GetSiteInstanceForURL(ext2_url1); | 243 manager1->GetSiteInstanceForURL(ext2_url1); |
256 EXPECT_NE(site11, site21); | 244 EXPECT_NE(site11, site21); |
257 | 245 |
258 scoped_refptr<SiteInstance> other_profile_site = | 246 scoped_refptr<SiteInstance> other_profile_site = |
259 manager2->GetSiteInstanceForURL(ext1_url1); | 247 manager2->GetSiteInstanceForURL(ext1_url1); |
260 EXPECT_NE(site11, other_profile_site); | 248 EXPECT_NE(site11, other_profile_site); |
261 } | 249 } |
262 | 250 |
263 } // namespace extensions | 251 } // namespace extensions |
OLD | NEW |