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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | |
9 #include "chromeos/dbus/shill_client_unittest_base.h" | 8 #include "chromeos/dbus/shill_client_unittest_base.h" |
10 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h" | 9 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h" |
11 #include "chromeos/dbus/shill_third_party_vpn_observer.h" | 10 #include "chromeos/dbus/shill_third_party_vpn_observer.h" |
12 #include "third_party/cros_system_api/dbus/service_constants.h" | 11 #include "third_party/cros_system_api/dbus/service_constants.h" |
13 | 12 |
14 using testing::_; | 13 using testing::_; |
15 | 14 |
16 namespace chromeos { | 15 namespace chromeos { |
17 | 16 |
18 namespace { | 17 namespace { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 { | 66 { |
68 dbus::MessageWriter writer(&pmessage_signal); | 67 dbus::MessageWriter writer(&pmessage_signal); |
69 writer.AppendUint32(connected_state); | 68 writer.AppendUint32(connected_state); |
70 } | 69 } |
71 | 70 |
72 dbus::Signal preceived_signal(shill::kFlimflamThirdPartyVpnInterface, | 71 dbus::Signal preceived_signal(shill::kFlimflamThirdPartyVpnInterface, |
73 shill::kOnPacketReceivedFunction); | 72 shill::kOnPacketReceivedFunction); |
74 { | 73 { |
75 dbus::MessageWriter writer(&preceived_signal); | 74 dbus::MessageWriter writer(&preceived_signal); |
76 writer.AppendArrayOfBytes( | 75 writer.AppendArrayOfBytes( |
77 reinterpret_cast<const uint8_t*>(vector_as_array(&data_packet)), | 76 reinterpret_cast<const uint8_t*>(data_packet.data()), |
78 data_packet.size()); | 77 data_packet.size()); |
79 } | 78 } |
80 | 79 |
81 // Expect each signal to be triggered once. | 80 // Expect each signal to be triggered once. |
82 MockShillThirdPartyVpnObserver observer; | 81 MockShillThirdPartyVpnObserver observer; |
83 EXPECT_CALL(observer, OnPlatformMessage(connected_state)).Times(1); | 82 EXPECT_CALL(observer, OnPlatformMessage(connected_state)).Times(1); |
84 EXPECT_CALL(observer, OnPacketReceived(data_packet)).Times(1); | 83 EXPECT_CALL(observer, OnPacketReceived(data_packet)).Times(1); |
85 | 84 |
86 client_->AddShillThirdPartyVpnObserver(kExampleIPConfigPath, &observer); | 85 client_->AddShillThirdPartyVpnObserver(kExampleIPConfigPath, &observer); |
87 | 86 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 client_->SendPacket( | 183 client_->SendPacket( |
185 kExampleIPConfigPath, data, | 184 kExampleIPConfigPath, data, |
186 base::Bind(&ShillThirdPartyVpnDriverClientTest::MockSuccess, | 185 base::Bind(&ShillThirdPartyVpnDriverClientTest::MockSuccess, |
187 base::Unretained(this)), | 186 base::Unretained(this)), |
188 base::Bind(&Failure)); | 187 base::Bind(&Failure)); |
189 | 188 |
190 message_loop_.RunUntilIdle(); | 189 message_loop_.RunUntilIdle(); |
191 } | 190 } |
192 | 191 |
193 } // namespace chromeos | 192 } // namespace chromeos |
OLD | NEW |