[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / chromeos / dbus / fake_gsm_sms_client.h
blob69a3ebead64c5fd102ad046c7119f58283dfe5f4
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_
8 #include <string>
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"
15 namespace chromeos {
17 // A fake implementation of GsmSMSClient used for tests.
18 class CHROMEOS_EXPORT FakeGsmSMSClient : public GsmSMSClient {
19 public:
20 FakeGsmSMSClient();
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,
32 uint32 index,
33 const DeleteCallback& callback) override;
34 void Get(const std::string& service_name,
35 const dbus::ObjectPath& object_path,
36 uint32 index,
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;
50 private:
51 void PushTestMessageChain();
52 void PushTestMessageDelayed();
53 bool PushTestMessage();
55 int test_index_;
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_