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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
53 return service->GetGlobalErrorByMenuItemCommandID(IDC_EXTENSION_ERRORS) != | 53 return service->GetGlobalErrorByMenuItemCommandID(IDC_EXTENSION_ERRORS) != |
54 NULL; | 54 NULL; |
55 } | 55 } |
56 | 56 |
57 const char* ext1_id = "extension1"; | 57 const char* ext1_id = "extension1"; |
58 const char* ext2_id = "extension2"; | 58 const char* ext2_id = "extension2"; |
59 const ExtensionWarning::WarningType warning_1 = | |
60 ExtensionWarning::kNetworkDelay; | |
61 const ExtensionWarning::WarningType warning_2 = | |
62 ExtensionWarning::kNetworkConflict; | |
63 | 59 |
64 } // namespace | 60 } // namespace |
65 | 61 |
66 // Check that no badge appears if it has been suppressed for a specific | 62 // Check that no badge appears if it has been suppressed for a specific |
67 // warning. | 63 // warning. |
68 TEST(ExtensionWarningBadgeServiceTest, SuppressBadgeForCurrentWarnings) { | 64 TEST(ExtensionWarningBadgeServiceTest, SuppressBadgeForCurrentWarnings) { |
69 TestingProfile profile; | 65 TestingProfile profile; |
70 TestExtensionWarningSet warnings(&profile); | 66 TestExtensionWarningSet warnings(&profile); |
71 TestExtensionWarningBadgeService badge_service(&profile, &warnings); | 67 TestExtensionWarningBadgeService badge_service(&profile, &warnings); |
72 warnings.AddObserver(&badge_service); | 68 warnings.AddObserver(&badge_service); |
(...skipping 17 matching lines...) Expand all Loading... |
90 EXPECT_FALSE(HasBadge(&profile)); | 86 EXPECT_FALSE(HasBadge(&profile)); |
91 | 87 |
92 // Set second warning and verify that it shows a badge. | 88 // Set second warning and verify that it shows a badge. |
93 warnings.AddWarning(ExtensionWarning::CreateNetworkConflictWarning(ext2_id)); | 89 warnings.AddWarning(ExtensionWarning::CreateNetworkConflictWarning(ext2_id)); |
94 EXPECT_TRUE(HasBadge(&profile)); | 90 EXPECT_TRUE(HasBadge(&profile)); |
95 | 91 |
96 warnings.RemoveObserver(&badge_service); | 92 warnings.RemoveObserver(&badge_service); |
97 } | 93 } |
98 | 94 |
99 } // namespace extensions | 95 } // namespace extensions |
OLD | NEW |