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 #ifndef COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_MOCK_H__ | 5 #ifndef COMPONENTS_SYNC_MODEL_DATA_TYPE_ERROR_HANDLER_MOCK_H__ |
6 #define COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_MOCK_H__ | 6 #define COMPONENTS_SYNC_MODEL_DATA_TYPE_ERROR_HANDLER_MOCK_H__ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "components/sync/api/data_type_error_handler.h" | |
12 #include "components/sync/base/model_type.h" | 11 #include "components/sync/base/model_type.h" |
| 12 #include "components/sync/model/data_type_error_handler.h" |
13 | 13 |
14 namespace syncer { | 14 namespace syncer { |
15 | 15 |
16 // A mock DataTypeErrorHandler for testing. Set the expected error type with | 16 // A mock DataTypeErrorHandler for testing. Set the expected error type with |
17 // ExpectError and OnUnrecoverableError will pass. If the error is not called | 17 // ExpectError and OnUnrecoverableError will pass. If the error is not called |
18 // this object's destructor will DCHECK. | 18 // this object's destructor will DCHECK. |
19 class DataTypeErrorHandlerMock : public DataTypeErrorHandler { | 19 class DataTypeErrorHandlerMock : public DataTypeErrorHandler { |
20 public: | 20 public: |
21 DataTypeErrorHandlerMock(); | 21 DataTypeErrorHandlerMock(); |
22 ~DataTypeErrorHandlerMock() override; | 22 ~DataTypeErrorHandlerMock() override; |
23 | 23 |
24 void OnUnrecoverableError(const SyncError& error) override; | 24 void OnUnrecoverableError(const SyncError& error) override; |
25 SyncError CreateAndUploadError(const tracked_objects::Location& location, | 25 SyncError CreateAndUploadError(const tracked_objects::Location& location, |
26 const std::string& message, | 26 const std::string& message, |
27 ModelType type) override; | 27 ModelType type) override; |
28 std::unique_ptr<DataTypeErrorHandler> Copy() const override; | 28 std::unique_ptr<DataTypeErrorHandler> Copy() const override; |
29 | 29 |
30 // Set the |error_type| to expect. | 30 // Set the |error_type| to expect. |
31 void ExpectError(SyncError::ErrorType error_type); | 31 void ExpectError(SyncError::ErrorType error_type); |
32 | 32 |
33 private: | 33 private: |
34 // The error type to expect. | 34 // The error type to expect. |
35 SyncError::ErrorType expected_error_type_ = SyncError::UNSET; | 35 SyncError::ErrorType expected_error_type_ = SyncError::UNSET; |
36 }; | 36 }; |
37 | 37 |
38 } // namespace syncer | 38 } // namespace syncer |
39 | 39 |
40 #endif // COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_MOCK_H__ | 40 #endif // COMPONENTS_SYNC_MODEL_DATA_TYPE_ERROR_HANDLER_MOCK_H__ |
OLD | NEW |