Commit c6e44e52 authored by Jon Mann's avatar Jon Mann Committed by Commit Bot

Store a network's last connected timestamp in the sync proto.

Bug: 966270
Change-Id: If3e181f61e0cbf3dd5adb673c182797ee6a42006
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2097835Reviewed-by: default avatarAzeem Arshad <azeemarshad@chromium.org>
Reviewed-by: default avatarJames Vecore <vecore@google.com>
Commit-Queue: Jon Mann <jonmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749769}
parent 4e9587d5
...@@ -149,6 +149,9 @@ void LocalNetworkCollectorImpl::StartGetNetworkDetails( ...@@ -149,6 +149,9 @@ void LocalNetworkCollectorImpl::StartGetNetworkDetails(
proto.set_hex_ssid(network->type_state->get_wifi()->hex_ssid); proto.set_hex_ssid(network->type_state->get_wifi()->hex_ssid);
proto.set_security_type( proto.set_security_type(
SecurityTypeProtoFromMojo(network->type_state->get_wifi()->security)); SecurityTypeProtoFromMojo(network->type_state->get_wifi()->security));
base::TimeDelta timestamp =
network_metadata_store_->GetLastConnectedTimestamp(network->guid);
proto.set_last_update_timestamp(timestamp.InMilliseconds());
cros_network_config_->GetManagedProperties( cros_network_config_->GetManagedProperties(
network->guid, network->guid,
base::BindOnce(&LocalNetworkCollectorImpl::OnGetManagedPropertiesResult, base::BindOnce(&LocalNetworkCollectorImpl::OnGetManagedPropertiesResult,
......
...@@ -77,13 +77,15 @@ class LocalNetworkCollectorImplTest : public testing::Test { ...@@ -77,13 +77,15 @@ class LocalNetworkCollectorImplTest : public testing::Test {
} }
void OnGetSyncableNetwork( void OnGetSyncableNetwork(
std::string expected, std::string expected_ssid,
base::Optional<sync_pb::WifiConfigurationSpecifics> result) { base::Optional<sync_pb::WifiConfigurationSpecifics> result) {
if (expected.empty()) { if (expected_ssid.empty()) {
ASSERT_EQ(base::nullopt, result); ASSERT_EQ(base::nullopt, result);
return; return;
} }
EXPECT_EQ(expected, DecodeHexString(result->hex_ssid())); EXPECT_EQ(expected_ssid, DecodeHexString(result->hex_ssid()));
EXPECT_TRUE(result->has_last_update_timestamp());
EXPECT_NE(0, result->last_update_timestamp());
} }
LocalNetworkCollector* local_network_collector() { LocalNetworkCollector* local_network_collector() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment