| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_warning_badge_service.h" | 5 #include "chrome/browser/extensions/extension_warning_badge_service.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/extensions/extension_warning_set.h" | 8 #include "chrome/browser/extensions/extension_warning_set.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/global_error/global_error_service.h" | 10 #include "chrome/browser/ui/global_error/global_error_service.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 class TestExtensionWarningBadgeService : public ExtensionWarningBadgeService { | 33 class TestExtensionWarningBadgeService : public ExtensionWarningBadgeService { |
| 34 public: | 34 public: |
| 35 TestExtensionWarningBadgeService(Profile* profile, | 35 TestExtensionWarningBadgeService(Profile* profile, |
| 36 ExtensionWarningService* warning_service) | 36 ExtensionWarningService* warning_service) |
| 37 : ExtensionWarningBadgeService(profile), | 37 : ExtensionWarningBadgeService(profile), |
| 38 warning_service_(warning_service) {} | 38 warning_service_(warning_service) {} |
| 39 virtual ~TestExtensionWarningBadgeService() {} | 39 virtual ~TestExtensionWarningBadgeService() {} |
| 40 | 40 |
| 41 virtual const std::set<ExtensionWarning>& GetCurrentWarnings() const { | 41 virtual const std::set<ExtensionWarning>& |
| 42 GetCurrentWarnings() const OVERRIDE { |
| 42 return warning_service_->warnings(); | 43 return warning_service_->warnings(); |
| 43 } | 44 } |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 ExtensionWarningService* warning_service_; | 47 ExtensionWarningService* warning_service_; |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 bool HasBadge(Profile* profile) { | 50 bool HasBadge(Profile* profile) { |
| 50 GlobalErrorService* service = | 51 GlobalErrorService* service = |
| 51 GlobalErrorServiceFactory::GetForProfile(profile); | 52 GlobalErrorServiceFactory::GetForProfile(profile); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 EXPECT_FALSE(HasBadge(&profile)); | 90 EXPECT_FALSE(HasBadge(&profile)); |
| 90 | 91 |
| 91 // Set second warning and verify that it shows a badge. | 92 // Set second warning and verify that it shows a badge. |
| 92 warnings.AddWarning(ExtensionWarning::CreateNetworkConflictWarning(ext2_id)); | 93 warnings.AddWarning(ExtensionWarning::CreateNetworkConflictWarning(ext2_id)); |
| 93 EXPECT_TRUE(HasBadge(&profile)); | 94 EXPECT_TRUE(HasBadge(&profile)); |
| 94 | 95 |
| 95 warnings.RemoveObserver(&badge_service); | 96 warnings.RemoveObserver(&badge_service); |
| 96 } | 97 } |
| 97 | 98 |
| 98 } // namespace extensions | 99 } // namespace extensions |
| OLD | NEW |