| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/extensions/extension_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 } | 663 } |
| 664 | 664 |
| 665 class ExtensionServiceTest | 665 class ExtensionServiceTest |
| 666 : public ExtensionServiceTestBase, public content::NotificationObserver { | 666 : public ExtensionServiceTestBase, public content::NotificationObserver { |
| 667 public: | 667 public: |
| 668 ExtensionServiceTest() | 668 ExtensionServiceTest() |
| 669 : installed_(NULL), | 669 : installed_(NULL), |
| 670 was_update_(false), | 670 was_update_(false), |
| 671 override_external_install_prompt_( | 671 override_external_install_prompt_( |
| 672 FeatureSwitch::prompt_for_external_extensions(), false) { | 672 FeatureSwitch::prompt_for_external_extensions(), false) { |
| 673 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 673 registrar_.Add(this, |
| 674 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 674 content::NotificationService::AllSources()); | 675 content::NotificationService::AllSources()); |
| 675 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 676 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 676 content::NotificationService::AllSources()); | 677 content::NotificationService::AllSources()); |
| 677 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 678 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 678 content::NotificationService::AllSources()); | 679 content::NotificationService::AllSources()); |
| 679 } | 680 } |
| 680 | 681 |
| 681 virtual void Observe(int type, | 682 virtual void Observe(int type, |
| 682 const content::NotificationSource& source, | 683 const content::NotificationSource& source, |
| 683 const content::NotificationDetails& details) OVERRIDE { | 684 const content::NotificationDetails& details) OVERRIDE { |
| 684 switch (type) { | 685 switch (type) { |
| 685 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 686 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| 686 const Extension* extension = | 687 const Extension* extension = |
| 687 content::Details<const Extension>(details).ptr(); | 688 content::Details<const Extension>(details).ptr(); |
| 688 loaded_.push_back(make_scoped_refptr(extension)); | 689 loaded_.push_back(make_scoped_refptr(extension)); |
| 689 // The tests rely on the errors being in a certain order, which can vary | 690 // The tests rely on the errors being in a certain order, which can vary |
| 690 // depending on how filesystem iteration works. | 691 // depending on how filesystem iteration works. |
| 691 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder()); | 692 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder()); |
| 692 break; | 693 break; |
| 693 } | 694 } |
| 694 | 695 |
| 695 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { | 696 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| (...skipping 6213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6909 // ReconcileKnownDisabled(). | 6910 // ReconcileKnownDisabled(). |
| 6910 service_->EnableExtension(good2); | 6911 service_->EnableExtension(good2); |
| 6911 service_->ReconcileKnownDisabled(); | 6912 service_->ReconcileKnownDisabled(); |
| 6912 expected_extensions.insert(good2); | 6913 expected_extensions.insert(good2); |
| 6913 expected_disabled_extensions.erase(good2); | 6914 expected_disabled_extensions.erase(good2); |
| 6914 | 6915 |
| 6915 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs()); | 6916 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs()); |
| 6916 EXPECT_EQ(expected_disabled_extensions, | 6917 EXPECT_EQ(expected_disabled_extensions, |
| 6917 registry_->disabled_extensions().GetIDs()); | 6918 registry_->disabled_extensions().GetIDs()); |
| 6918 } | 6919 } |
| OLD | NEW |