1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__
6 #define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__
7 #pragma once
8
9 #include "chrome/browser/sync/glue/data_type_manager.h"
10 #include "chrome/browser/sync/profile_sync_test_util.h"
11 #include "content/common/notification_details.h"
12 #include "content/common/notification_service.h"
13 #include "content/common/notification_type.h"
14 #include "testing/gmock/include/gmock/gmock.h"
15
ACTION_P3(NotifyFromDataTypeManagerWithResult,dtm,type,result)16 ACTION_P3(NotifyFromDataTypeManagerWithResult, dtm, type, result) {
17 NotificationService::current()->Notify(
18 type,
19 Source<browser_sync::DataTypeManager>(dtm),
20 Details<browser_sync::DataTypeManager::ConfigureResultWithErrorLocation>(
21 result));
22 }
23
ACTION_P2(NotifyFromDataTypeManager,dtm,type)24 ACTION_P2(NotifyFromDataTypeManager, dtm, type) {
25 NotificationService::current()->Notify(type,
26 Source<browser_sync::DataTypeManager>(dtm),
27 NotificationService::NoDetails());
28 }
29
30 namespace browser_sync {
31
32 class DataTypeManagerMock : public DataTypeManager {
33 public:
34 DataTypeManagerMock();
35 virtual ~DataTypeManagerMock();
36
37 MOCK_METHOD1(Configure, void(const TypeSet&));
38 MOCK_METHOD0(Stop, void());
39 MOCK_METHOD0(controllers, const DataTypeController::TypeMap&());
40 MOCK_METHOD0(state, State());
41
42 private:
43 browser_sync::DataTypeManager::ConfigureResultWithErrorLocation result_;
44 };
45
46 } // namespace browser_sync
47
48 #endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__
49