| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMEOS_DBUS_IBUS_MOCK_IBUS_ENGINE_FACTORY_SERVICE_H_ | |
| 6 #define CHROMEOS_DBUS_IBUS_MOCK_IBUS_ENGINE_FACTORY_SERVICE_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "chromeos/dbus/ibus/ibus_engine_factory_service.h" | |
| 13 #include "dbus/object_path.h" | |
| 14 | |
| 15 namespace chromeos { | |
| 16 class MockIBusEngineFactoryService : public IBusEngineFactoryService { | |
| 17 public: | |
| 18 MockIBusEngineFactoryService(); | |
| 19 virtual ~MockIBusEngineFactoryService(); | |
| 20 | |
| 21 virtual void SetCreateEngineHandler( | |
| 22 const std::string& engine_id, | |
| 23 const CreateEngineHandler& create_engine_handler) OVERRIDE; | |
| 24 virtual void UnsetCreateEngineHandler( | |
| 25 const std::string& engine_id) OVERRIDE; | |
| 26 virtual dbus::ObjectPath GenerateUniqueObjectPath() OVERRIDE; | |
| 27 | |
| 28 bool CallCreateEngine(const std::string& engine_id); | |
| 29 | |
| 30 int set_create_engine_handler_call_count() const { | |
| 31 return set_create_engine_handler_call_count_; | |
| 32 } | |
| 33 | |
| 34 int unset_create_engine_handler_call_count() const { | |
| 35 return unset_create_engine_handler_call_count_; | |
| 36 } | |
| 37 | |
| 38 dbus::ObjectPath GetObjectPathByEngineId(const std::string& engine_id); | |
| 39 | |
| 40 private: | |
| 41 void OnEngineCreated(const std::string& engine_id, | |
| 42 const dbus::ObjectPath& path); | |
| 43 | |
| 44 std::map<std::string, CreateEngineHandler> handler_map_; | |
| 45 std::map<std::string, dbus::ObjectPath> object_path_map_; | |
| 46 int set_create_engine_handler_call_count_; | |
| 47 int unset_create_engine_handler_call_count_; | |
| 48 base::WeakPtrFactory<MockIBusEngineFactoryService> weak_ptr_factory_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(MockIBusEngineFactoryService); | |
| 51 }; | |
| 52 | |
| 53 } // namespace chromeos | |
| 54 | |
| 55 #endif // CHROMEOS_DBUS_IBUS_MOCK_IBUS_ENGINE_FACTORY_SERVICE_H_ | |
| OLD | NEW |