OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MOCK_INCIDENT_RECEIVER_H
_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MOCK_INCIDENT_RECEIVER_H
_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MOCK_INCIDENT_RECEIVER_H
_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MOCK_INCIDENT_RECEIVER_H
_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h" | 10 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 | 12 |
13 namespace safe_browsing { | 13 namespace safe_browsing { |
14 | 14 |
15 class MockIncidentReceiver : public IncidentReceiver { | 15 class MockIncidentReceiver : public IncidentReceiver { |
16 public: | 16 public: |
17 MockIncidentReceiver(); | 17 MockIncidentReceiver(); |
18 ~MockIncidentReceiver(); | 18 ~MockIncidentReceiver(); |
19 | 19 |
20 MOCK_METHOD2(DoAddIncidentForProfile, void(Profile*, scoped_ptr<Incident>*)); | 20 MOCK_METHOD2(DoAddIncidentForProfile, |
21 MOCK_METHOD1(DoAddIncidentForProcess, void(scoped_ptr<Incident>*)); | 21 void(Profile*, std::unique_ptr<Incident>*)); |
22 MOCK_METHOD1(DoClearIncidentForProcess, void(scoped_ptr<Incident>*)); | 22 MOCK_METHOD1(DoAddIncidentForProcess, void(std::unique_ptr<Incident>*)); |
| 23 MOCK_METHOD1(DoClearIncidentForProcess, void(std::unique_ptr<Incident>*)); |
23 | 24 |
24 protected: | 25 protected: |
25 void AddIncidentForProfile(Profile* profile, | 26 void AddIncidentForProfile(Profile* profile, |
26 scoped_ptr<Incident> incident) override { | 27 std::unique_ptr<Incident> incident) override { |
27 DoAddIncidentForProfile(profile, &incident); | 28 DoAddIncidentForProfile(profile, &incident); |
28 } | 29 } |
29 | 30 |
30 void AddIncidentForProcess(scoped_ptr<Incident> incident) override { | 31 void AddIncidentForProcess(std::unique_ptr<Incident> incident) override { |
31 DoAddIncidentForProcess(&incident); | 32 DoAddIncidentForProcess(&incident); |
32 } | 33 } |
33 | 34 |
34 void ClearIncidentForProcess(scoped_ptr<Incident> incident) override { | 35 void ClearIncidentForProcess(std::unique_ptr<Incident> incident) override { |
35 DoClearIncidentForProcess(&incident); | 36 DoClearIncidentForProcess(&incident); |
36 } | 37 } |
37 }; | 38 }; |
38 | 39 |
39 // An action that passes ownership of the incident in |arg0| to |recipient|. | 40 // An action that passes ownership of the incident in |arg0| to |recipient|. |
40 ACTION_P(TakeIncident, recipient) { | 41 ACTION_P(TakeIncident, recipient) { |
41 *recipient = std::move(*arg0); | 42 *recipient = std::move(*arg0); |
42 } | 43 } |
43 | 44 |
44 // An action that passes ownership of the incident in |arg0| to the vector in | 45 // An action that passes ownership of the incident in |arg0| to the vector in |
45 // |incidents|. | 46 // |incidents|. |
46 ACTION_P(TakeIncidentToVector, incidents) { | 47 ACTION_P(TakeIncidentToVector, incidents) { |
47 incidents->push_back(std::move(*arg0)); | 48 incidents->push_back(std::move(*arg0)); |
48 } | 49 } |
49 | 50 |
50 } // namespace safe_browsing | 51 } // namespace safe_browsing |
51 | 52 |
52 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MOCK_INCIDENT_RECEIVE
R_H_ | 53 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MOCK_INCIDENT_RECEIVE
R_H_ |
OLD | NEW |