OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ |
6 #define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ | 6 #define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/sync/glue/data_type_manager.h" | 9 #include "chrome/browser/sync/glue/data_type_manager.h" |
10 #include "chrome/browser/sync/profile_sync_test_util.h" | 10 #include "chrome/browser/sync/profile_sync_test_util.h" |
11 #include "content/public/browser/notification_details.h" | 11 #include "content/public/browser/notification_details.h" |
12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
13 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
14 #include "sync/api/sync_error.h" | 14 #include "sync/api/sync_error.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 | 16 |
17 ACTION_P2(InvokeCallback, datatype, callback_result) { | 17 ACTION_P2(InvokeCallback, datatype, callback_result) { |
18 if (callback_result != browser_sync::DataTypeController::OK) { | 18 if (callback_result != browser_sync::DataTypeController::OK) { |
19 SyncError error(FROM_HERE, "Error message", datatype); | 19 csync::SyncError error(FROM_HERE, "Error message", datatype); |
20 arg0.Run(callback_result, error); | 20 arg0.Run(callback_result, error); |
21 } else { | 21 } else { |
22 arg0.Run(callback_result, SyncError()); | 22 arg0.Run(callback_result, csync::SyncError()); |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 ACTION_P3(InvokeCallbackPointer, callback, datatype, callback_result) { | 26 ACTION_P3(InvokeCallbackPointer, callback, datatype, callback_result) { |
27 if (callback_result != browser_sync::DataTypeController::OK) { | 27 if (callback_result != browser_sync::DataTypeController::OK) { |
28 SyncError error(FROM_HERE, "Error message", datatype); | 28 csync::SyncError error(FROM_HERE, "Error message", datatype); |
29 callback.Run(callback_result, error); | 29 callback.Run(callback_result, error); |
30 } else { | 30 } else { |
31 callback.Run(callback_result, SyncError()); | 31 callback.Run(callback_result, csync::SyncError()); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 ACTION_P3(NotifyFromDataTypeManagerWithResult, dtm, type, result) { | 35 ACTION_P3(NotifyFromDataTypeManagerWithResult, dtm, type, result) { |
36 content::NotificationService::current()->Notify( | 36 content::NotificationService::current()->Notify( |
37 type, | 37 type, |
38 content::Source<browser_sync::DataTypeManager>(dtm), | 38 content::Source<browser_sync::DataTypeManager>(dtm), |
39 content::Details<const browser_sync::DataTypeManager::ConfigureResult>( | 39 content::Details<const browser_sync::DataTypeManager::ConfigureResult>( |
40 result)); | 40 result)); |
41 } | 41 } |
(...skipping 18 matching lines...) Expand all Loading... |
60 MOCK_METHOD0(controllers, const DataTypeController::TypeMap&()); | 60 MOCK_METHOD0(controllers, const DataTypeController::TypeMap&()); |
61 MOCK_CONST_METHOD0(state, State()); | 61 MOCK_CONST_METHOD0(state, State()); |
62 | 62 |
63 private: | 63 private: |
64 browser_sync::DataTypeManager::ConfigureResult result_; | 64 browser_sync::DataTypeManager::ConfigureResult result_; |
65 }; | 65 }; |
66 | 66 |
67 } // namespace browser_sync | 67 } // namespace browser_sync |
68 | 68 |
69 #endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ | 69 #endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ |
OLD | NEW |