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.
5 #ifndef CHROMEOS_DBUS_FAKE_GSM_SMS_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_GSM_SMS_CLIENT_H_
10 #include "base/memory/weak_ptr.h"
11 #include "base/values.h"
12 #include "chromeos/dbus/gsm_sms_client.h"
13 #include "dbus/object_path.h"
17 // A fake implementation of GsmSMSClient used for tests.
18 class CHROMEOS_EXPORT FakeGsmSMSClient
: public GsmSMSClient
{
21 ~FakeGsmSMSClient() override
;
23 // GsmSMSClient overrides
24 void Init(dbus::Bus
* bus
) override
;
25 void SetSmsReceivedHandler(const std::string
& service_name
,
26 const dbus::ObjectPath
& object_path
,
27 const SmsReceivedHandler
& handler
) override
;
28 void ResetSmsReceivedHandler(const std::string
& service_name
,
29 const dbus::ObjectPath
& object_path
) override
;
30 void Delete(const std::string
& service_name
,
31 const dbus::ObjectPath
& object_path
,
33 const DeleteCallback
& callback
) override
;
34 void Get(const std::string
& service_name
,
35 const dbus::ObjectPath
& object_path
,
37 const GetCallback
& callback
) override
;
38 void List(const std::string
& service_name
,
39 const dbus::ObjectPath
& object_path
,
40 const ListCallback
& callback
) override
;
41 void RequestUpdate(const std::string
& service_name
,
42 const dbus::ObjectPath
& object_path
) override
;
44 // Sets if the command line switch for test is present. RequestUpdate()
45 // changes its behavior depending on the switch.
46 void set_sms_test_message_switch_present(bool is_present
) {
47 sms_test_message_switch_present_
= is_present
;
51 void PushTestMessageChain();
52 void PushTestMessageDelayed();
53 bool PushTestMessage();
56 std::vector
<std::string
> test_messages_
;
57 base::ListValue message_list_
;
58 SmsReceivedHandler handler_
;
60 bool sms_test_message_switch_present_
;
62 base::WeakPtrFactory
<FakeGsmSMSClient
> weak_ptr_factory_
;
64 DISALLOW_COPY_AND_ASSIGN(FakeGsmSMSClient
);
67 } // namespace chromeos
69 #endif // CHROMEOS_DBUS_FAKE_GSM_SMS_CLIENT_H_