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