blob: ea16972088df9b5cb9ae35921bb54c54e1c2b064 [file] [log] [blame]
Peter Qiue9b75802015-01-20 15:24:15 -08001// Copyright 2015 The Chromium OS 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.
4
5#ifndef SHILL_ARP_CLIENT_TEST_HELPER_H_
6#define SHILL_ARP_CLIENT_TEST_HELPER_H_
7
8#include <base/macros.h>
9
10#include "shill/arp_packet.h"
11#include "shill/mock_arp_client.h"
12#include "shill/net/byte_string.h"
13#include "shill/net/ip_address.h"
14
15namespace shill {
16
17// Class for simulate ARP client receiving ARP packets for unit test purpose.
18class ArpClientTestHelper {
19 public:
Paul Stewarta794cd62015-06-16 13:13:10 -070020 explicit ArpClientTestHelper(MockArpClient* client);
Peter Qiue9b75802015-01-20 15:24:15 -080021 virtual ~ArpClientTestHelper();
22
23 void GeneratePacket(uint16_t operation,
Paul Stewarta794cd62015-06-16 13:13:10 -070024 const IPAddress& local_ip,
25 const ByteString& local_mac,
26 const IPAddress& remote_ip,
27 const ByteString& remote_mac);
Peter Qiue9b75802015-01-20 15:24:15 -080028
29 private:
Paul Stewarta794cd62015-06-16 13:13:10 -070030 bool SimulateReceivePacket(ArpPacket* packet, ByteString* sender);
Peter Qiue9b75802015-01-20 15:24:15 -080031
Paul Stewarta794cd62015-06-16 13:13:10 -070032 MockArpClient* client_;
Peter Qiue9b75802015-01-20 15:24:15 -080033 ArpPacket packet_;
34
35 DISALLOW_COPY_AND_ASSIGN(ArpClientTestHelper);
36};
37
38} // namespace shill
39
40#endif // SHILL_ARP_CLIENT_TEST_HELPER_H_