1 //
2 // Copyright (C) 2014 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef SHILL_WIFI_MOCK_WAKE_ON_WIFI_H_
18 #define SHILL_WIFI_MOCK_WAKE_ON_WIFI_H_
19 
20 #include <string>
21 #include <vector>
22 
23 #include <gmock/gmock.h>
24 
25 #include "shill/net/nl80211_message.h"
26 #include "shill/wifi/wake_on_wifi.h"
27 
28 namespace shill {
29 
30 class MockWakeOnWiFi : public WakeOnWiFi {
31  public:
32   MockWakeOnWiFi(NetlinkManager* netlink_manager, EventDispatcher* dispatcher,
33                  Metrics* metrics);
34   ~MockWakeOnWiFi() override;
35 
36   MOCK_METHOD0(OnAfterResume, void());
37   MOCK_METHOD7(OnBeforeSuspend,
38                void(bool is_connected,
39                     const std::vector<ByteString>& ssid_whitelist,
40                     const ResultCallback& done_callback,
41                     const base::Closure& renew_dhcp_lease_callback,
42                     const base::Closure& remove_supplicant_networks_callback,
43                     bool have_dhcp_lease, uint32_t time_to_next_lease_renewal));
44   MOCK_METHOD6(OnDarkResume,
45                void(bool is_connected,
46                     const std::vector<ByteString>& ssid_whitelist,
47                     const ResultCallback& done_callback,
48                     const base::Closure& renew_dhcp_lease_callback,
49                     const InitiateScanCallback& initiate_scan_callback,
50                     const base::Closure& remove_supplicant_networks_callback));
51   MOCK_METHOD2(OnConnectedAndReachable,
52                void(bool start_lease_renewal_timer,
53                     uint32_t time_to_next_lease_renewal));
54   MOCK_METHOD1(ReportConnectedToServiceAfterWake, void(bool is_connected));
55   MOCK_METHOD3(OnNoAutoConnectableServicesAfterScan,
56                void(const std::vector<ByteString>& ssid_whitelist,
57                     const base::Closure& remove_supplicant_networks_callback,
58                     const InitiateScanCallback& initiate_scan_callback));
59   MOCK_METHOD1(OnWakeupReasonReceived,
60                void(const NetlinkMessage& netlink_message));
61   MOCK_METHOD0(NotifyWakeupReasonReceived, void());
62   MOCK_METHOD1(NotifyWakeOnWiFiOnDarkResume,
63                void(WakeOnWiFi::WakeOnWiFiTrigger reason));
64   MOCK_METHOD1(OnWiphyIndexReceived, void(uint32_t));
65   MOCK_METHOD1(ParseWakeOnWiFiCapabilities,
66                void(const Nl80211Message& nl80211_message));
67   MOCK_METHOD1(OnScanStarted, void(bool is_active_scan));
68 
69  private:
70   DISALLOW_COPY_AND_ASSIGN(MockWakeOnWiFi);
71 };
72 
73 }  // namespace shill
74 
75 #endif  // SHILL_WIFI_MOCK_WAKE_ON_WIFI_H_
76