Home | History | Annotate | Download | only in ime
      1 // Copyright (c) 2013 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_IME_MOCK_IBUS_DAEMON_CONTROLLER_H_
      6 #define CHROMEOS_IME_MOCK_IBUS_DAEMON_CONTROLLER_H_
      7 
      8 #include "base/observer_list.h"
      9 #include "chromeos/chromeos_export.h"
     10 #include "chromeos/ime/ibus_daemon_controller.h"
     11 
     12 namespace chromeos {
     13 
     14 // A mock implementation of IBusDaemonController.
     15 class CHROMEOS_EXPORT MockIBusDaemonController : public IBusDaemonController {
     16  public:
     17   MockIBusDaemonController();
     18   virtual ~MockIBusDaemonController();
     19 
     20   // IBusDaemonController overrides:
     21   virtual void AddObserver(Observer* observer) OVERRIDE;
     22   virtual void RemoveObserver(Observer* observer) OVERRIDE;
     23   virtual bool Start() OVERRIDE;
     24   virtual bool Stop() OVERRIDE;
     25 
     26   // Emulates connecting/disconnecting the connection with ibus-daemon.
     27   void EmulateConnect();
     28   void EmulateDisconnect();
     29 
     30   int start_count() { return start_count_;}
     31   int stop_count() { return stop_count_;}
     32 
     33  private:
     34   int start_count_;
     35   int stop_count_;
     36 
     37   ObserverList<Observer> observers_;
     38 
     39   DISALLOW_COPY_AND_ASSIGN(MockIBusDaemonController);
     40 };
     41 
     42 }  // namespace chromeos
     43 
     44 #endif  // CHROMEOS_IME_MOCK_IBUS_DAEMON_CONTROLLER_H_
     45