| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ProcessManager::Create(original_context())); | 73 ProcessManager::Create(original_context())); |
| 74 | 74 |
| 75 EXPECT_EQ(original_context(), manager1->GetBrowserContext()); | 75 EXPECT_EQ(original_context(), manager1->GetBrowserContext()); |
| 76 EXPECT_EQ(0u, manager1->background_hosts().size()); | 76 EXPECT_EQ(0u, manager1->background_hosts().size()); |
| 77 | 77 |
| 78 // It observes other notifications from this context. | 78 // It observes other notifications from this context. |
| 79 EXPECT_TRUE(IsRegistered(manager1.get(), | 79 EXPECT_TRUE(IsRegistered(manager1.get(), |
| 80 chrome::NOTIFICATION_EXTENSIONS_READY, | 80 chrome::NOTIFICATION_EXTENSIONS_READY, |
| 81 original_context())); | 81 original_context())); |
| 82 EXPECT_TRUE(IsRegistered(manager1.get(), | 82 EXPECT_TRUE(IsRegistered(manager1.get(), |
| 83 chrome::NOTIFICATION_EXTENSION_LOADED, | 83 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 84 original_context())); | 84 original_context())); |
| 85 EXPECT_TRUE(IsRegistered(manager1.get(), | 85 EXPECT_TRUE(IsRegistered(manager1.get(), |
| 86 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 86 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 87 original_context())); | 87 original_context())); |
| 88 EXPECT_TRUE(IsRegistered(manager1.get(), | 88 EXPECT_TRUE(IsRegistered(manager1.get(), |
| 89 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 89 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| 90 original_context())); | 90 original_context())); |
| 91 | 91 |
| 92 // Test for an incognito context ProcessManager. | 92 // Test for an incognito context ProcessManager. |
| 93 scoped_ptr<ProcessManager> manager2(ProcessManager::CreateIncognitoForTesting( | 93 scoped_ptr<ProcessManager> manager2(ProcessManager::CreateIncognitoForTesting( |
| 94 incognito_context(), original_context(), manager1.get())); | 94 incognito_context(), original_context(), manager1.get())); |
| 95 | 95 |
| 96 EXPECT_EQ(incognito_context(), manager2->GetBrowserContext()); | 96 EXPECT_EQ(incognito_context(), manager2->GetBrowserContext()); |
| 97 EXPECT_EQ(0u, manager2->background_hosts().size()); | 97 EXPECT_EQ(0u, manager2->background_hosts().size()); |
| 98 | 98 |
| 99 // Some notifications are observed for the original context. | 99 // Some notifications are observed for the original context. |
| 100 EXPECT_TRUE(IsRegistered(manager2.get(), | 100 EXPECT_TRUE(IsRegistered(manager2.get(), |
| 101 chrome::NOTIFICATION_EXTENSION_LOADED, | 101 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 102 original_context())); | 102 original_context())); |
| 103 | 103 |
| 104 // Some notifications are observed for the incognito context. | 104 // Some notifications are observed for the incognito context. |
| 105 EXPECT_TRUE(IsRegistered(manager2.get(), | 105 EXPECT_TRUE(IsRegistered(manager2.get(), |
| 106 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 106 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| 107 incognito_context())); | 107 incognito_context())); |
| 108 | 108 |
| 109 // Some notifications are observed for both incognito and original. | 109 // Some notifications are observed for both incognito and original. |
| 110 EXPECT_TRUE(IsRegistered(manager2.get(), | 110 EXPECT_TRUE(IsRegistered(manager2.get(), |
| 111 chrome::NOTIFICATION_PROFILE_DESTROYED, | 111 chrome::NOTIFICATION_PROFILE_DESTROYED, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 scoped_refptr<SiteInstance> site21 = | 155 scoped_refptr<SiteInstance> site21 = |
| 156 manager1->GetSiteInstanceForURL(ext2_url1); | 156 manager1->GetSiteInstanceForURL(ext2_url1); |
| 157 EXPECT_NE(site11, site21); | 157 EXPECT_NE(site11, site21); |
| 158 | 158 |
| 159 scoped_refptr<SiteInstance> other_profile_site = | 159 scoped_refptr<SiteInstance> other_profile_site = |
| 160 manager2->GetSiteInstanceForURL(ext1_url1); | 160 manager2->GetSiteInstanceForURL(ext1_url1); |
| 161 EXPECT_NE(site11, other_profile_site); | 161 EXPECT_NE(site11, other_profile_site); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace extensions | 164 } // namespace extensions |
| OLD | NEW |