[email protected] | b4d3771d | 2012-11-14 14:44:10 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
hanxi | c7e5520 | 2014-08-28 14:13:21 | [diff] [blame] | 5 | #include "extensions/browser/warning_service.h" |
[email protected] | b4d3771d | 2012-11-14 14:44:10 | [diff] [blame] | 6 | |
hanxi | c7e5520 | 2014-08-28 14:13:21 | [diff] [blame] | 7 | #include "content/public/test/test_browser_context.h" |
8 | #include "extensions/browser/extensions_test.h" | ||||
[email protected] | b4d3771d | 2012-11-14 14:44:10 | [diff] [blame] | 9 | #include "testing/gmock/include/gmock/gmock.h" |
10 | #include "testing/gtest/include/gtest/gtest.h" | ||||
11 | |||||
12 | namespace extensions { | ||||
13 | |||||
14 | namespace { | ||||
15 | |||||
hanxi | c7e5520 | 2014-08-28 14:13:21 | [diff] [blame] | 16 | class TestWarningService : public WarningService { |
[email protected] | b4d3771d | 2012-11-14 14:44:10 | [diff] [blame] | 17 | public: |
hanxi | c7e5520 | 2014-08-28 14:13:21 | [diff] [blame] | 18 | explicit TestWarningService(content::BrowserContext* browser_context) |
19 | : WarningService(browser_context) { | ||||
[email protected] | b4d3771d | 2012-11-14 14:44:10 | [diff] [blame] | 20 | } |
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 21 | ~TestWarningService() override {} |
[email protected] | b4d3771d | 2012-11-14 14:44:10 | [diff] [blame] | 22 | |
hanxi | c7e5520 | 2014-08-28 14:13:21 | [diff] [blame] | 23 | void AddWarning(const Warning& warning) { |
24 | WarningSet warnings; | ||||
[email protected] | b4d3771d | 2012-11-14 14:44:10 | [diff] [blame] | 25 | warnings.insert(warning); |
26 | AddWarnings(warnings); | ||||
27 | } | ||||
28 | }; | ||||
29 | |||||
hanxi | c7e5520 | 2014-08-28 14:13:21 | [diff] [blame] | 30 | class MockObserver : public WarningService::Observer { |
[email protected] | b4d3771d | 2012-11-14 14:44:10 | [diff] [blame] | 31 | public: |
32 | virtual ~MockObserver() {} | ||||
rdevlin.cronin | 7dd05290 | 2015-05-19 22:23:22 | [diff] [blame] | 33 | MOCK_METHOD1(ExtensionWarningsChanged, void(const ExtensionIdSet&)); |
[email protected] | b4d3771d | 2012-11-14 14:44:10 | [diff] [blame] | 34 | }; |
35 | |||||
Lukasz Anforowicz | 58d0dac | 2018-03-23 15:48:10 | [diff] [ |