OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/fake_shill_third_party_vpn_driver_client.h" | 5 #include "chromeos/dbus/fake_shill_third_party_vpn_driver_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chromeos/dbus/shill_third_party_vpn_observer.h" | 9 #include "chromeos/dbus/shill_third_party_vpn_observer.h" |
10 #include "dbus/object_proxy.h" | 10 #include "dbus/object_proxy.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 void FakeShillThirdPartyVpnDriverClient::UpdateConnectionState( | 50 void FakeShillThirdPartyVpnDriverClient::UpdateConnectionState( |
51 const std::string& object_path_value, | 51 const std::string& object_path_value, |
52 const uint32_t connection_state, | 52 const uint32_t connection_state, |
53 const base::Closure& callback, | 53 const base::Closure& callback, |
54 const ShillClientHelper::ErrorCallback& error_callback) { | 54 const ShillClientHelper::ErrorCallback& error_callback) { |
55 base::MessageLoop::current()->PostTask(FROM_HERE, callback); | 55 base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
56 } | 56 } |
57 | 57 |
58 void FakeShillThirdPartyVpnDriverClient::SendPacket( | 58 void FakeShillThirdPartyVpnDriverClient::SendPacket( |
59 const std::string& object_path_value, | 59 const std::string& object_path_value, |
60 const std::string& ip_packet, | 60 const std::vector<char>& ip_packet, |
61 const base::Closure& callback, | 61 const base::Closure& callback, |
62 const ShillClientHelper::ErrorCallback& error_callback) { | 62 const ShillClientHelper::ErrorCallback& error_callback) { |
63 base::MessageLoop::current()->PostTask(FROM_HERE, callback); | 63 base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
64 } | 64 } |
65 | 65 |
66 void FakeShillThirdPartyVpnDriverClient::OnPacketReceived( | 66 void FakeShillThirdPartyVpnDriverClient::OnPacketReceived( |
67 const std::string& object_path_value, | 67 const std::string& object_path_value, |
68 const std::string& packet) { | 68 const std::vector<char>& packet) { |
69 ObserverMap::iterator it = observer_map_.find(object_path_value); | 69 ObserverMap::iterator it = observer_map_.find(object_path_value); |
70 if (it == observer_map_.end()) { | 70 if (it == observer_map_.end()) { |
71 LOG(ERROR) << "Unexpected OnPacketReceived for " << object_path_value; | 71 LOG(ERROR) << "Unexpected OnPacketReceived for " << object_path_value; |
72 return; | 72 return; |
73 } | 73 } |
74 | 74 |
75 it->second->OnPacketReceived(packet); | 75 it->second->OnPacketReceived(packet); |
76 } | 76 } |
77 | 77 |
78 void FakeShillThirdPartyVpnDriverClient::OnPlatformMessage( | 78 void FakeShillThirdPartyVpnDriverClient::OnPlatformMessage( |
79 const std::string& object_path_value, | 79 const std::string& object_path_value, |
80 uint32_t message) { | 80 uint32_t message) { |
81 ObserverMap::iterator it = observer_map_.find(object_path_value); | 81 ObserverMap::iterator it = observer_map_.find(object_path_value); |
82 if (it == observer_map_.end()) { | 82 if (it == observer_map_.end()) { |
83 LOG(ERROR) << "Unexpected OnPlatformMessage for " << object_path_value; | 83 LOG(ERROR) << "Unexpected OnPlatformMessage for " << object_path_value; |
84 return; | 84 return; |
85 } | 85 } |
86 | 86 |
87 it->second->OnPlatformMessage(message); | 87 it->second->OnPlatformMessage(message); |
88 } | 88 } |
89 | 89 |
90 ShillThirdPartyVpnDriverClient::TestInterface* | 90 ShillThirdPartyVpnDriverClient::TestInterface* |
91 FakeShillThirdPartyVpnDriverClient::GetTestInterface() { | 91 FakeShillThirdPartyVpnDriverClient::GetTestInterface() { |
92 return this; | 92 return this; |
93 } | 93 } |
94 | 94 |
95 } // namespace chromeos | 95 } // namespace chromeos |
OLD | NEW |