Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: chrome/browser/chromeos/policy/device_status_collector_browsertest.cc

Issue 1062853005: Map signal_strength from percentage to dBm per spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaked comment. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
diff --git a/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
index 605017b24ad69cd2231205b6ee4c90027fa9a977..b3ec4903ca4b715b110b347be6710004700e9836 100644
--- a/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
@@ -985,6 +985,7 @@ struct FakeNetworkState {
const char* device_path;
const char* type;
int signal_strength;
+ int expected_signal_strength;
const char* connection_status;
int expected_state;
const char* address;
@@ -996,36 +997,36 @@ struct FakeNetworkState {
// by convention shill will not report a signal strength of 0 for a visible
// network, so we use 1 below.
static const FakeNetworkState kFakeNetworks[] = {
- { "offline", "/device/wifi", shill::kTypeWifi, 35,
+ { "offline", "/device/wifi", shill::kTypeWifi, 35, -85,
shill::kStateOffline, em::NetworkState::OFFLINE, "", "" },
- { "ethernet", "/device/ethernet", shill::kTypeEthernet, 0,
+ { "ethernet", "/device/ethernet", shill::kTypeEthernet, 0, 0,
shill::kStateOnline, em::NetworkState::ONLINE,
"192.168.0.1", "8.8.8.8" },
- { "wifi", "/device/wifi", shill::kTypeWifi, 23, shill::kStatePortal,
+ { "wifi", "/device/wifi", shill::kTypeWifi, 23, -97, shill::kStatePortal,
em::NetworkState::PORTAL, "", "" },
- { "idle", "/device/cellular1", shill::kTypeCellular, 0, shill::kStateIdle,
+ { "idle", "/device/cellular1", shill::kTypeCellular, 0, 0, shill::kStateIdle,
Thiemo Nagel 2015/04/16 15:16:33 I'm unsure what the expected behaviour for cellula
Andrew T Wilson (Slow) 2015/04/17 14:41:02 I've changed this to just not report for cellular
em::NetworkState::IDLE, "", "" },
- { "carrier", "/device/cellular1", shill::kTypeCellular, 0,
+ { "carrier", "/device/cellular1", shill::kTypeCellular, 0, 0,
shill::kStateCarrier, em::NetworkState::CARRIER, "", "" },
- { "association", "/device/cellular1", shill::kTypeCellular, 0,
+ { "association", "/device/cellular1", shill::kTypeCellular, 0, 0,
shill::kStateAssociation, em::NetworkState::ASSOCIATION, "", "" },
- { "config", "/device/cellular1", shill::kTypeCellular, 0,
+ { "config", "/device/cellular1", shill::kTypeCellular, 0, 0,
shill::kStateConfiguration, em::NetworkState::CONFIGURATION, "", "" },
- { "ready", "/device/cellular1", shill::kTypeCellular, 0, shill::kStateReady,
- em::NetworkState::READY, "", "" },
- { "disconnect", "/device/wifi", shill::kTypeWifi, 1,
+ { "ready", "/device/cellular1", shill::kTypeCellular, 0, 0,
+ shill::kStateReady, em::NetworkState::READY, "", "" },
+ { "disconnect", "/device/wifi", shill::kTypeWifi, 1, -119,
shill::kStateDisconnect, em::NetworkState::DISCONNECT, "", "" },
- { "failure", "/device/wifi", shill::kTypeWifi, 1, shill::kStateFailure,
+ { "failure", "/device/wifi", shill::kTypeWifi, 1, -119, shill::kStateFailure,
em::NetworkState::FAILURE, "", "" },
- { "activation-failure", "/device/cellular1", shill::kTypeCellular, 0,
+ { "activation-failure", "/device/cellular1", shill::kTypeCellular, 0, 0,
shill::kStateActivationFailure, em::NetworkState::ACTIVATION_FAILURE,
"", "" },
- { "unknown", "", shill::kTypeWifi, 1, "unknown", em::NetworkState::UNKNOWN,
- "", "" },
+ { "unknown", "", shill::kTypeWifi, 1, -119, "unknown",
+ em::NetworkState::UNKNOWN, "", "" },
};
static const FakeNetworkState kUnconfiguredNetwork = {
- "unconfigured", "/device/unconfigured", shill::kTypeWifi, 35,
+ "unconfigured", "/device/unconfigured", shill::kTypeWifi, 35, -85,
shill::kStateOffline, em::NetworkState::OFFLINE, "", ""
};
@@ -1210,8 +1211,10 @@ TEST_F(DeviceStatusCollectorNetworkInterfacesTest, NetworkInterfaces) {
bool found_match = false;
for (const em::NetworkState& proto_state : status_.network_state()) {
// Make sure every item has a matching entry in the proto.
+ bool should_have_signal_strength = state.expected_signal_strength != 0;
if (proto_state.has_device_path() == (strlen(state.device_path) > 0) &&
- proto_state.signal_strength() == state.signal_strength &&
+ proto_state.has_signal_strength() == should_have_signal_strength &&
+ proto_state.signal_strength() == state.expected_signal_strength &&
proto_state.connection_state() == state.expected_state) {
if (proto_state.has_ip_address())
EXPECT_EQ(proto_state.ip_address(), state.address);

Powered by Google App Engine
This is Rietveld 408576698