1 // Copyright 2014 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_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_
10 #include "chromeos/chromeos_export.h"
11 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h"
15 // A fake implementation of ShillThirdPartyVpnDriverClient.
16 // The client can generate fake DBus signals when
17 // ShillThirdPartyVpnDriverClient::TestInterface methods are called. The
18 // DBus methods are nops that only acknowledge the caller.
19 class CHROMEOS_EXPORT FakeShillThirdPartyVpnDriverClient
20 : public ShillThirdPartyVpnDriverClient
,
21 public ShillThirdPartyVpnDriverClient::TestInterface
{
23 FakeShillThirdPartyVpnDriverClient();
24 ~FakeShillThirdPartyVpnDriverClient() override
;
26 // ShillThirdPartyVpnDriverClient overrides
27 void Init(dbus::Bus
* bus
) override
;
28 void AddShillThirdPartyVpnObserver(
29 const std::string
& object_path_value
,
30 ShillThirdPartyVpnObserver
* observer
) override
;
31 void RemoveShillThirdPartyVpnObserver(
32 const std::string
& object_path_value
) override
;
34 const std::string
& object_path_value
,
35 const base::DictionaryValue
& parameters
,
36 const base::Closure
& callback
,
37 const ShillClientHelper::ErrorCallback
& error_callback
) override
;
38 void UpdateConnectionState(
39 const std::string
& object_path_value
,
40 const uint32_t connection_state
,
41 const base::Closure
& callback
,
42 const ShillClientHelper::ErrorCallback
& error_callback
) override
;
44 const std::string
& object_path_value
,
45 const std::string
& ip_packet
,
46 const base::Closure
& callback
,
47 const ShillClientHelper::ErrorCallback
& error_callback
) override
;
48 ShillThirdPartyVpnDriverClient::TestInterface
* GetTestInterface() override
;
50 // ShillThirdPartyVpnDriverClient::TestInterface overrides
51 void OnPacketReceived(const std::string
& object_path_value
,
52 const std::string
& packet
) override
;
53 void OnPlatformMessage(const std::string
& object_path_value
,
54 uint32_t message
) override
;
57 using ObserverMap
= std::map
<std::string
, ShillThirdPartyVpnObserver
*>;
59 ObserverMap observer_map_
;
61 DISALLOW_COPY_AND_ASSIGN(FakeShillThirdPartyVpnDriverClient
);
64 } // namespace chromeos
66 #endif // CHROMEOS_DBUS_FAKE_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_