| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/common/notification_details.h" | 11 #include "chrome/common/notification_details.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 23 ACTION_P2(NotifyFromDataTypeManager, dtm, type) { | 23 ACTION_P2(NotifyFromDataTypeManager, dtm, type) { |
| 24 NotificationService::current()->Notify(type, | 24 NotificationService::current()->Notify(type, |
| 25 Source<browser_sync::DataTypeManager>(dtm), | 25 Source<browser_sync::DataTypeManager>(dtm), |
| 26 NotificationService::NoDetails()); | 26 NotificationService::NoDetails()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace browser_sync { | 29 namespace browser_sync { |
| 30 | 30 |
| 31 class DataTypeManagerMock : public DataTypeManager { | 31 class DataTypeManagerMock : public DataTypeManager { |
| 32 public: | 32 public: |
| 33 DataTypeManagerMock() : result_(OK) { | 33 DataTypeManagerMock(); |
| 34 // By default, calling Configure will send a SYNC_CONFIGURE_START | 34 virtual ~DataTypeManagerMock(); |
| 35 // and SYNC_CONFIGURE_DONE notification with a DataTypeManager::OK | |
| 36 // detail. | |
| 37 ON_CALL(*this, Configure(testing::_)). | |
| 38 WillByDefault(testing::DoAll( | |
| 39 NotifyFromDataTypeManager(this, | |
| 40 NotificationType::SYNC_CONFIGURE_START), | |
| 41 NotifyFromDataTypeManagerWithResult | |
| 42 (this, NotificationType::SYNC_CONFIGURE_DONE, &result_))); | |
| 43 } | |
| 44 | 35 |
| 45 MOCK_METHOD1(Configure, void(const TypeSet&)); | 36 MOCK_METHOD1(Configure, void(const TypeSet&)); |
| 46 MOCK_METHOD0(Stop, void()); | 37 MOCK_METHOD0(Stop, void()); |
| 47 MOCK_METHOD0(controllers, const DataTypeController::TypeMap&()); | 38 MOCK_METHOD0(controllers, const DataTypeController::TypeMap&()); |
| 48 MOCK_METHOD0(state, State()); | 39 MOCK_METHOD0(state, State()); |
| 49 | 40 |
| 50 private: | 41 private: |
| 51 DataTypeManager::ConfigureResult result_; | 42 DataTypeManager::ConfigureResult result_; |
| 52 }; | 43 }; |
| 53 | 44 |
| 54 } // namespace browser_sync | 45 } // namespace browser_sync |
| 55 | 46 |
| 56 #endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ | 47 #endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ |
| OLD | NEW |