| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/lifetime/application_lifetime.h" | 8 #include "chrome/browser/lifetime/application_lifetime.h" |
| 9 #include "chrome/browser/notifications/notification_system_observer.h" | 9 #include "chrome/browser/notifications/notification_system_observer.h" |
| 10 #include "chrome/browser/notifications/notification_test_util.h" | 10 #include "chrome/browser/notifications/notification_test_util.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 std::unique_ptr<StubNotificationUIManager> ui_manager_; | 57 std::unique_ptr<StubNotificationUIManager> ui_manager_; |
| 58 std::unique_ptr<NotificationSystemObserver> notification_observer_; | 58 std::unique_ptr<NotificationSystemObserver> notification_observer_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 TEST_F(NotificationSystemObserverTest, MultiProfileExtensionUnloaded) { | 61 TEST_F(NotificationSystemObserverTest, MultiProfileExtensionUnloaded) { |
| 62 scoped_refptr<const extensions::Extension> extension = | 62 scoped_refptr<const extensions::Extension> extension = |
| 63 CreateGoodExtension("foo"); | 63 CreateGoodExtension("foo"); |
| 64 ASSERT_NE(extension->url(), ui_manager()->last_canceled_source()); | 64 ASSERT_NE(extension->url(), ui_manager()->last_canceled_source()); |
| 65 // Claim the extension has been unloaded. | 65 // Claim the extension has been unloaded. |
| 66 extensions::ExtensionRegistry::Get(profile())->TriggerOnUnloaded( | 66 extensions::ExtensionRegistry::Get(profile())->TriggerOnUnloaded( |
| 67 extension.get(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL); | 67 extension.get(), extensions::UnloadedExtensionReason::REASON_UNINSTALL); |
| 68 // Check the NotificationUIManger has canceled the source coming from the | 68 // Check the NotificationUIManger has canceled the source coming from the |
| 69 // unloaded extension. | 69 // unloaded extension. |
| 70 EXPECT_EQ(extension->url(), ui_manager()->last_canceled_source()); | 70 EXPECT_EQ(extension->url(), ui_manager()->last_canceled_source()); |
| 71 | 71 |
| 72 TestingProfile* profile2 = | 72 TestingProfile* profile2 = |
| 73 profile_manager()->CreateTestingProfile("test-profile2"); | 73 profile_manager()->CreateTestingProfile("test-profile2"); |
| 74 scoped_refptr<const extensions::Extension> extension2 = | 74 scoped_refptr<const extensions::Extension> extension2 = |
| 75 CreateGoodExtension("bar"); | 75 CreateGoodExtension("bar"); |
| 76 // Claim the extension has been unloaded with anoter profile. | 76 // Claim the extension has been unloaded with anoter profile. |
| 77 extensions::ExtensionRegistry::Get(profile2)->TriggerOnUnloaded( | 77 extensions::ExtensionRegistry::Get(profile2)->TriggerOnUnloaded( |
| 78 extension2.get(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL); | 78 extension2.get(), extensions::UnloadedExtensionReason::REASON_UNINSTALL); |
| 79 EXPECT_EQ(extension2->url(), ui_manager()->last_canceled_source()); | 79 EXPECT_EQ(extension2->url(), ui_manager()->last_canceled_source()); |
| 80 } | 80 } |
| OLD | NEW |