OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "chrome/browser/extensions/extension_error_controller.h" | 6 #include "chrome/browser/extensions/extension_error_controller.h" |
7 #include "chrome/browser/extensions/extension_error_ui.h" | 7 #include "chrome/browser/extensions/extension_error_ui.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_service_test_base.h" | 9 #include "chrome/browser/extensions/extension_service_test_base.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Wrappers around the similar methods in ExtensionErrorUI. | 31 // Wrappers around the similar methods in ExtensionErrorUI. |
32 void CloseUI(); | 32 void CloseUI(); |
33 void Accept(); | 33 void Accept(); |
34 void Details(); | 34 void Details(); |
35 | 35 |
36 ExtensionErrorUI::Delegate* delegate() { return delegate_; } | 36 ExtensionErrorUI::Delegate* delegate() { return delegate_; } |
37 | 37 |
38 private: | 38 private: |
39 // ExtensionErrorUI implementation. | 39 // ExtensionErrorUI implementation. |
40 virtual bool ShowErrorInBubbleView() OVERRIDE; | 40 virtual bool ShowErrorInBubbleView() override; |
41 virtual void ShowExtensions() OVERRIDE; | 41 virtual void ShowExtensions() override; |
42 virtual void Close() OVERRIDE; | 42 virtual void Close() override; |
43 | 43 |
44 // Keep a copy of the delegate around for ourselves. | 44 // Keep a copy of the delegate around for ourselves. |
45 ExtensionErrorUI::Delegate* delegate_; | 45 ExtensionErrorUI::Delegate* delegate_; |
46 }; | 46 }; |
47 | 47 |
48 // We use this as a slight hack to get the created Error UI, if any. We should | 48 // We use this as a slight hack to get the created Error UI, if any. We should |
49 // only ever have one (since this is a single-profile test), and this avoids | 49 // only ever have one (since this is a single-profile test), and this avoids |
50 // the need for any kind of accessor to the ErrorController from | 50 // the need for any kind of accessor to the ErrorController from |
51 // ExtensionService. | 51 // ExtensionService. |
52 MockExtensionErrorUI* g_error_ui = NULL; | 52 MockExtensionErrorUI* g_error_ui = NULL; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 .Set("version", "0.1.1.0") | 97 .Set("version", "0.1.1.0") |
98 .Set("manifest_version", 2) | 98 .Set("manifest_version", 2) |
99 .Build()) | 99 .Build()) |
100 .Build(); | 100 .Build(); |
101 } | 101 } |
102 | 102 |
103 } // namespace | 103 } // namespace |
104 | 104 |
105 class ExtensionErrorControllerUnitTest : public ExtensionServiceTestBase { | 105 class ExtensionErrorControllerUnitTest : public ExtensionServiceTestBase { |
106 protected: | 106 protected: |
107 virtual void SetUp() OVERRIDE; | 107 virtual void SetUp() override; |
108 | 108 |
109 // Add an extension to chrome, and mark it as blacklisted in the prefs. | 109 // Add an extension to chrome, and mark it as blacklisted in the prefs. |
110 testing::AssertionResult AddBlacklistedExtension(const Extension* extension); | 110 testing::AssertionResult AddBlacklistedExtension(const Extension* extension); |
111 | 111 |
112 // Return the ExtensionPrefs associated with the test. | 112 // Return the ExtensionPrefs associated with the test. |
113 ExtensionPrefs* GetPrefs(); | 113 ExtensionPrefs* GetPrefs(); |
114 | 114 |
115 Profile* profile() { return profile_.get(); } | 115 Profile* profile() { return profile_.get(); } |
116 }; | 116 }; |
117 | 117 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 GetPrefs()->AcknowledgeBlacklistedExtension(extension->id()); | 205 GetPrefs()->AcknowledgeBlacklistedExtension(extension->id()); |
206 | 206 |
207 service_->Init(); | 207 service_->Init(); |
208 | 208 |
209 // We should never have made an alert, because the extension should already | 209 // We should never have made an alert, because the extension should already |
210 // be acknowledged. | 210 // be acknowledged. |
211 ASSERT_FALSE(g_error_ui); | 211 ASSERT_FALSE(g_error_ui); |
212 } | 212 } |
213 | 213 |
214 } // namespace extensions | 214 } // namespace extensions |
OLD | NEW |