1b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// found in the LICENSE file.
4b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
5b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#ifndef CHROMEOS_DBUS_FAKE_GSM_SMS_CLIENT_H_
6b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#define CHROMEOS_DBUS_FAKE_GSM_SMS_CLIENT_H_
7b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
8b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include <string>
9b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
10b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "base/memory/weak_ptr.h"
11b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "base/values.h"
12b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "chromeos/dbus/gsm_sms_client.h"
13b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "dbus/object_path.h"
14b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
15b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)namespace chromeos {
16b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
17b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// A fake implementation of GsmSMSClient used for tests.
184e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class CHROMEOS_EXPORT FakeGsmSMSClient : public GsmSMSClient {
19b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) public:
20b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  FakeGsmSMSClient();
21b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual ~FakeGsmSMSClient();
22b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
23424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // GsmSMSClient overrides
24424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  virtual void Init(dbus::Bus* bus) OVERRIDE;
25b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void SetSmsReceivedHandler(const std::string& service_name,
26b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                                     const dbus::ObjectPath& object_path,
27b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                                     const SmsReceivedHandler& handler)
28b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)      OVERRIDE;
29b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void ResetSmsReceivedHandler(const std::string& service_name,
30b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                                       const dbus::ObjectPath& object_path)
31b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)      OVERRIDE;
32b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void Delete(const std::string& service_name,
33b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                      const dbus::ObjectPath& object_path,
34b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                      uint32 index,
35b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                      const DeleteCallback& callback) OVERRIDE;
36b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void Get(const std::string& service_name,
37b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                   const dbus::ObjectPath& object_path,
38b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                   uint32 index,
39b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                   const GetCallback& callback) OVERRIDE;
40b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void List(const std::string& service_name,
41b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                    const dbus::ObjectPath& object_path,
42b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                    const ListCallback& callback) OVERRIDE;
43b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void RequestUpdate(const std::string& service_name,
44b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                             const dbus::ObjectPath& object_path) OVERRIDE;
45b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
46b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  // Sets if the command line switch for test is present. RequestUpdate()
47b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  // changes its behavior depending on the switch.
48b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  void set_sms_test_message_switch_present(bool is_present) {
49b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    sms_test_message_switch_present_ = is_present;
50b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  }
51b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
52b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) private:
53b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  void PushTestMessageChain();
54b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  void PushTestMessageDelayed();
55b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  bool PushTestMessage();
56b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
57b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  int test_index_;
58b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  std::vector<std::string> test_messages_;
59b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  base::ListValue message_list_;
60b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  SmsReceivedHandler handler_;
61b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
62b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  bool sms_test_message_switch_present_;
63b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
64b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  base::WeakPtrFactory<FakeGsmSMSClient> weak_ptr_factory_;
65b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
66b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(FakeGsmSMSClient);
67b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)};
68b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
69b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)}  // namespace chromeos
70b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
71b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#endif  // CHROMEOS_DBUS_FAKE_GSM_SMS_CLIENT_H_
72