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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/global_error/global_error_service.h" | 9 #include "chrome/browser/ui/global_error/global_error_service.h" |
10 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 10 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
(...skipping 21 matching lines...) Expand all Loading... |
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 WarningService* warning_service) | 36 WarningService* 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<Warning>& | 41 virtual const std::set<Warning>& |
42 GetCurrentWarnings() const OVERRIDE { | 42 GetCurrentWarnings() const override { |
43 return warning_service_->warnings(); | 43 return warning_service_->warnings(); |
44 } | 44 } |
45 | 45 |
46 private: | 46 private: |
47 WarningService* warning_service_; | 47 WarningService* warning_service_; |
48 }; | 48 }; |
49 | 49 |
50 bool HasBadge(Profile* profile) { | 50 bool HasBadge(Profile* profile) { |
51 GlobalErrorService* service = | 51 GlobalErrorService* service = |
52 GlobalErrorServiceFactory::GetForProfile(profile); | 52 GlobalErrorServiceFactory::GetForProfile(profile); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 EXPECT_FALSE(HasBadge(&profile)); | 86 EXPECT_FALSE(HasBadge(&profile)); |
87 | 87 |
88 // Set second warning and verify that it shows a badge. | 88 // Set second warning and verify that it shows a badge. |
89 warnings.AddWarning(Warning::CreateNetworkConflictWarning(ext2_id)); | 89 warnings.AddWarning(Warning::CreateNetworkConflictWarning(ext2_id)); |
90 EXPECT_TRUE(HasBadge(&profile)); | 90 EXPECT_TRUE(HasBadge(&profile)); |
91 | 91 |
92 warnings.RemoveObserver(&badge_service); | 92 warnings.RemoveObserver(&badge_service); |
93 } | 93 } |
94 | 94 |
95 } // namespace extensions | 95 } // namespace extensions |
OLD | NEW |