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