| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions_service_unittest.h" | 5 #include "chrome/browser/extensions/extensions_service_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 registrar_.Add(this, NotificationType::THEME_INSTALLED, | 415 registrar_.Add(this, NotificationType::THEME_INSTALLED, |
| 416 NotificationService::AllSources()); | 416 NotificationService::AllSources()); |
| 417 } | 417 } |
| 418 | 418 |
| 419 virtual void Observe(NotificationType type, | 419 virtual void Observe(NotificationType type, |
| 420 const NotificationSource& source, | 420 const NotificationSource& source, |
| 421 const NotificationDetails& details) { | 421 const NotificationDetails& details) { |
| 422 switch (type.value) { | 422 switch (type.value) { |
| 423 case NotificationType::EXTENSION_LOADED: { | 423 case NotificationType::EXTENSION_LOADED: { |
| 424 const Extension* extension = Details<const Extension>(details).ptr(); | 424 const Extension* extension = Details<const Extension>(details).ptr(); |
| 425 loaded_.push_back(extension); | 425 loaded_.push_back(make_scoped_refptr(extension)); |
| 426 // The tests rely on the errors being in a certain order, which can vary | 426 // The tests rely on the errors being in a certain order, which can vary |
| 427 // depending on how filesystem iteration works. | 427 // depending on how filesystem iteration works. |
| 428 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder()); | 428 std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder()); |
| 429 break; | 429 break; |
| 430 } | 430 } |
| 431 | 431 |
| 432 case NotificationType::EXTENSION_UNLOADED: { | 432 case NotificationType::EXTENSION_UNLOADED: { |
| 433 const Extension* e = Details<const Extension>(details).ptr(); | 433 const Extension* e = Details<const Extension>(details).ptr(); |
| 434 unloaded_id_ = e->id(); | 434 unloaded_id_ = e->id(); |
| 435 ExtensionList::iterator i = | 435 ExtensionList::iterator i = |
| (...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2715 // Component extensions shouldn't get recourded in the prefs. | 2715 // Component extensions shouldn't get recourded in the prefs. |
| 2716 ValidatePrefKeyCount(0); | 2716 ValidatePrefKeyCount(0); |
| 2717 | 2717 |
| 2718 // Reload all extensions, and make sure it comes back. | 2718 // Reload all extensions, and make sure it comes back. |
| 2719 std::string extension_id = service_->extensions()->at(0)->id(); | 2719 std::string extension_id = service_->extensions()->at(0)->id(); |
| 2720 loaded_.clear(); | 2720 loaded_.clear(); |
| 2721 service_->ReloadExtensions(); | 2721 service_->ReloadExtensions(); |
| 2722 ASSERT_EQ(1u, service_->extensions()->size()); | 2722 ASSERT_EQ(1u, service_->extensions()->size()); |
| 2723 EXPECT_EQ(extension_id, service_->extensions()->at(0)->id()); | 2723 EXPECT_EQ(extension_id, service_->extensions()->at(0)->id()); |
| 2724 } | 2724 } |
| OLD | NEW |