| 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 class ExtensionServiceTest | 653 class ExtensionServiceTest |
| 654 : public ExtensionServiceTestBase, public content::NotificationObserver { | 654 : public ExtensionServiceTestBase, public content::NotificationObserver { |
| 655 public: | 655 public: |
| 656 ExtensionServiceTest() | 656 ExtensionServiceTest() |
| 657 : installed_(NULL), | 657 : installed_(NULL), |
| 658 was_update_(false), | 658 was_update_(false), |
| 659 override_external_install_prompt_( | 659 override_external_install_prompt_( |
| 660 FeatureSwitch::prompt_for_external_extensions(), false) { | 660 FeatureSwitch::prompt_for_external_extensions(), false) { |
| 661 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 661 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 662 content::NotificationService::AllSources()); | 662 content::NotificationService::AllSources()); |
| 663 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 663 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 664 content::NotificationService::AllSources()); | 664 content::NotificationService::AllSources()); |
| 665 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 665 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 666 content::NotificationService::AllSources()); | 666 content::NotificationService::AllSources()); |
| 667 } | 667 } |
| 668 | 668 |
| 669 virtual void Observe(int type, | 669 virtual void Observe(int type, |
| 670 const content::NotificationSource& source, | 670 const content::NotificationSource& source, |
| 671 const content::NotificationDetails& details) OVERRIDE { | 671 const content::NotificationDetails& details) OVERRIDE { |
| 672 switch (type) { | 672 switch (type) { |
| 673 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 673 case chrome::NOTIFICATION_EXTENSION_LOADED: { |
| 674 const Extension* extension = | 674 const Extension* extension = |
| 675 content::Details<const Extension>(details).ptr(); | 675 content::Details<const Extension>(details).ptr(); |
| 676 loaded_.push_back(make_scoped_refptr(extension)); | 676 loaded_.push_back(make_scoped_refptr(extension)); |
| 677 // The tests rely on the errors being in a certain order, which can vary | 677 // The tests rely on the errors being in a certain order, which can vary |
| 678 // depending on how filesystem iteration works. | 678 // depending on how filesystem iteration works. |
| 679 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder()); | 679 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder()); |
| 680 break; | 680 break; |
| 681 } | 681 } |
| 682 | 682 |
| 683 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 683 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 684 const Extension* e = | 684 const Extension* e = |
| 685 content::Details<extensions::UnloadedExtensionInfo>( | 685 content::Details<extensions::UnloadedExtensionInfo>( |
| 686 details)->extension; | 686 details)->extension; |
| 687 unloaded_id_ = e->id(); | 687 unloaded_id_ = e->id(); |
| 688 extensions::ExtensionList::iterator i = | 688 extensions::ExtensionList::iterator i = |
| 689 std::find(loaded_.begin(), loaded_.end(), e); | 689 std::find(loaded_.begin(), loaded_.end(), e); |
| 690 // TODO(erikkay) fix so this can be an assert. Right now the tests | 690 // TODO(erikkay) fix so this can be an assert. Right now the tests |
| 691 // are manually calling clear() on loaded_, so this isn't doable. | 691 // are manually calling clear() on loaded_, so this isn't doable. |
| 692 if (i == loaded_.end()) | 692 if (i == loaded_.end()) |
| 693 return; | 693 return; |
| (...skipping 6254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6948 // ReconcileKnownDisabled(). | 6948 // ReconcileKnownDisabled(). |
| 6949 service_->EnableExtension(good2); | 6949 service_->EnableExtension(good2); |
| 6950 service_->ReconcileKnownDisabled(); | 6950 service_->ReconcileKnownDisabled(); |
| 6951 expected_extensions.insert(good2); | 6951 expected_extensions.insert(good2); |
| 6952 expected_disabled_extensions.erase(good2); | 6952 expected_disabled_extensions.erase(good2); |
| 6953 | 6953 |
| 6954 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs()); | 6954 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs()); |
| 6955 EXPECT_EQ(expected_disabled_extensions, | 6955 EXPECT_EQ(expected_disabled_extensions, |
| 6956 registry_->disabled_extensions().GetIDs()); | 6956 registry_->disabled_extensions().GetIDs()); |
| 6957 } | 6957 } |
| OLD | NEW |