1 // 2 // Copyright (C) 2012 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_MOCK_METRICS_H_ 18 #define SHILL_MOCK_METRICS_H_ 19 20 #include <string> 21 22 #include "shill/metrics.h" 23 24 #include <gmock/gmock.h> 25 26 namespace shill { 27 28 class MockMetrics : public Metrics { 29 public: 30 explicit MockMetrics(EventDispatcher* dispatcher); 31 ~MockMetrics() override; 32 33 MOCK_METHOD0(Start, void()); 34 MOCK_METHOD0(Stop, void()); 35 MOCK_METHOD4(AddServiceStateTransitionTimer, 36 void(const Service& service, const std::string& histogram_name, 37 Service::ConnectState start_state, 38 Service::ConnectState stop_state)); 39 MOCK_METHOD1(DeregisterDevice, void(int interface_index)); 40 MOCK_METHOD1(NotifyDeviceScanStarted, void(int interface_index)); 41 MOCK_METHOD1(NotifyDeviceScanFinished, void(int interface_index)); 42 MOCK_METHOD1(ResetScanTimer, void(int interface_index)); 43 MOCK_METHOD2(NotifyDeviceConnectStarted, void(int interface_index, 44 bool is_auto_connecting)); 45 MOCK_METHOD1(NotifyDeviceConnectFinished, void(int interface_index)); 46 MOCK_METHOD1(ResetConnectTimer, void(int interface_index)); 47 MOCK_METHOD1(NotifyDefaultServiceChanged, void(const Service* service)); 48 MOCK_METHOD2(NotifyServiceStateChanged, 49 void(const Service& service, Service::ConnectState new_state)); 50 #if !defined(DISABLE_WIFI) 51 MOCK_METHOD2(Notify80211Disconnect, void(WiFiDisconnectByWhom by_whom, 52 IEEE_80211::WiFiReasonCode reason)); 53 #endif // DISABLE_WIFI 54 MOCK_METHOD0(Notify3GPPRegistrationDelayedDropPosted, void()); 55 MOCK_METHOD0(Notify3GPPRegistrationDelayedDropCanceled, void()); 56 MOCK_METHOD0(NotifyCorruptedProfile, void()); 57 MOCK_METHOD3(SendEnumToUMA, bool(const std::string& name, int sample, 58 int max)); 59 MOCK_METHOD5(SendToUMA, bool(const std::string& name, int sample, int min, 60 int max, int num_buckets)); 61 MOCK_METHOD2(SendSparseToUMA, bool(const std::string& name, int sample)); 62 MOCK_METHOD1(NotifyWifiAutoConnectableServices, void(int num_service)); 63 MOCK_METHOD1(NotifyWifiAvailableBSSes, void(int num_bss)); 64 MOCK_METHOD1(NotifyServicesOnSameNetwork, void(int num_service)); 65 MOCK_METHOD1(NotifyUserInitiatedEvent, void(int event)); 66 MOCK_METHOD1(NotifyWifiTxBitrate, void(int bitrate)); 67 MOCK_METHOD2(NotifyUserInitiatedConnectionResult, 68 void(const std::string& name, int result)); 69 MOCK_METHOD2(NotifyUserInitiatedConnectionFailureReason, 70 void(const std::string& name, 71 const Service::ConnectFailure failure)); 72 MOCK_METHOD2(NotifyNetworkProblemDetected, 73 void(Technology::Identifier technology_id, int reason)); 74 MOCK_METHOD2(NotifyFallbackDNSTestResult, 75 void(Technology::Identifier technology_id, int result)); 76 MOCK_METHOD1(NotifyDeviceConnectionStatus, 77 void(Metrics::ConnectionStatus status)); 78 MOCK_METHOD1(NotifyDhcpClientStatus, void(Metrics::DhcpClientStatus status)); 79 MOCK_METHOD2(NotifyNetworkConnectionIPType, 80 void(Technology::Identifier technology_id, 81 Metrics::NetworkConnectionIPType type)); 82 MOCK_METHOD2(NotifyIPv6ConnectivityStatus, 83 void(Technology::Identifier technology_id, bool status)); 84 MOCK_METHOD2(NotifyDevicePresenceStatus, 85 void(Technology::Identifier technology_id, bool status)); 86 MOCK_METHOD2(NotifyUnreliableLinkSignalStrength, 87 void(Technology::Identifier technology_id, int signal_strength)); 88 MOCK_METHOD1(NotifyVerifyWakeOnWiFiSettingsResult, 89 void(VerifyWakeOnWiFiSettingsResult result)); 90 MOCK_METHOD1(NotifyConnectedToServiceAfterWake, 91 void(WiFiConnectionStatusAfterWake status)); 92 MOCK_METHOD0(NotifyWakeOnWiFiThrottled, void()); 93 MOCK_METHOD0(NotifySuspendWithWakeOnWiFiEnabledDone, void()); 94 MOCK_METHOD0(NotifyDarkResumeInitiateScan, void()); 95 MOCK_METHOD0(NotifyWakeupReasonReceived, void()); 96 #if !defined(DISABLE_WIFI) 97 MOCK_METHOD1(NotifyWakeOnWiFiOnDarkResume, 98 void(WakeOnWiFi::WakeOnWiFiTrigger reason)); 99 #endif // DISABLE_WIFI 100 MOCK_METHOD1(NotifyScanStartedInDarkResume, void(bool is_active_scan)); 101 MOCK_METHOD0(NotifyDarkResumeScanRetry, void()); 102 MOCK_METHOD2(NotifyBeforeSuspendActions, 103 void(bool is_connected, bool in_dark_resume)); 104 MOCK_METHOD1(NotifyConnectionDiagnosticsIssue, 105 void(const std::string& issue)); 106 107 private: 108 DISALLOW_COPY_AND_ASSIGN(MockMetrics); 109 }; 110 111 } // namespace shill 112 113 #endif // SHILL_MOCK_METRICS_H_ 114