shill: do not report suspend readiness on gateway ARP

Pass a boolean from DHCPConfig::ProcessEventSignal to
IPConfig::UpdateProperties and Device::OnIPConfigUpdated that
indicates if a gateway ARP was received, and use this boolean
to determine whether or not to report suspend readiness when
WiFi::OnIPConfigUpdated is called in dark resume. This allows
us to accept both a Gateway ARP and BOUND event during dark
resume, and only report suspend readiness when the latter event
is received.

BUG=chromium:442610
TEST=Compile shill and run unit tests using:

P2_TEST_FILTER="shill::*" FEATURES="test" USE="clang asan" \
  emerge-samus shill

Manual testing as follows:

 1) Boot into a samus test image.
 2) Run 'ff_debug +wifi; ff_debug --level -3'
 3) Run 'echo 0 > /var/lib/power_manager/disable_dark_resume; restart \
    powerd'
 4) Enable all wake on WiFi features with the following command:
     dbus-send --system --print-reply --dest=org.chromium.flimflam \
       /device/wlan0 org.chromium.flimflam.Device.SetProperty \
         string:WakeOnWiFiFeaturesEnabled \
           variant:string:"packet_and_ssid"
 5) Set the wake-to-scan frequency to 30 seconds with the
    following command:
     dbus-send --system --print-reply --dest=org.chromium.flimflam \
       /device/wlan0 org.chromium.flimflam.Device.SetProperty \
         string:WakeToScanFrequency variant:uint32:30
 6) Connect samus to an AP.
 7) Disable the AP. Verify that the samus is fully disconnected by the WiFi
    icon state (a cross over empty WiFi bars).
 8) Run 'powerd_dbus_suspend' to suspend the system.
 9) Wait ~10 seconds for the system to fully suspend, then immediately re-enable
    the AP.
10) Wait for another ~20 seconds for the system to enter dark resume (light bar
    will turn on in dark resume).
11) After the dark resume concludes (~10 more seconds; light bar should turn
    off), wait another 30 seconds and verify that the system does not enter
    dark resume again (i.e. light bar does not light up again). This signifies
    that the system has established a connection in the last dark resume. If
    the system enters dark resume, repeat this step until the system no longer
    enters dark resume again.
12) Wake the samus by pressing any way, and verify that the WiFi icon is in the
    fully connected state.
13) Open /var/log/net.log
14) Search for the log messages containing "Gateway ARP received" and
    "IPv4 DHCP lease obtained". Verify that the former is logged before the
    latter, and that the two events are logged within the same second.
15) Verify that the log message containing the substring "OnDHCPLeaseObtained"
    appears immediately after the "IPv4 DHCP lease obtained message".

Change-Id: I8185c8683ed1a5e65779d67cca100faafbad6654
Reviewed-on: https://chromium-review.googlesource.com/236099
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
15 files changed