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

Unified Diff: chromeos/network/network_state_unittest.cc

Issue 2819383002: [CrOS Tether] Update NetworkState to include tether properties and integrate into NetworkStateHandl… (Closed)
Patch Set: stevenjb@ comment. Created 3 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
« no previous file with comments | « chromeos/network/network_state_handler_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_state_unittest.cc
diff --git a/chromeos/network/network_state_unittest.cc b/chromeos/network/network_state_unittest.cc
index 4941c108cf7df21dc9876109d2f344d933e2aa76..e151c96de34884a5b4fa812be6af3304cf640f75 100644
--- a/chromeos/network/network_state_unittest.cc
+++ b/chromeos/network/network_state_unittest.cc
@@ -14,6 +14,7 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
+#include "chromeos/network/tether_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -257,4 +258,29 @@ TEST_F(NetworkStateTest, ConnectionStateNotVisible) {
EXPECT_FALSE(network_state_.IsReconnecting());
}
+TEST_F(NetworkStateTest, TetherProperties) {
+ network_state_.set_type(kTypeTether);
+ network_state_.set_carrier("Project Fi");
+ network_state_.set_battery_percentage(85);
+ network_state_.set_signal_strength(75);
+
+ base::DictionaryValue dictionary;
+ network_state_.GetStateProperties(&dictionary);
+
+ int signal_strength;
+ EXPECT_TRUE(dictionary.GetIntegerWithoutPathExpansion(kTetherSignalStrength,
+ &signal_strength));
+ EXPECT_EQ(75, signal_strength);
+
+ int battery_percentage;
+ EXPECT_TRUE(dictionary.GetIntegerWithoutPathExpansion(
+ kTetherBatteryPercentage, &battery_percentage));
+ EXPECT_EQ(85, battery_percentage);
+
+ std::string carrier;
+ EXPECT_TRUE(
+ dictionary.GetStringWithoutPathExpansion(kTetherCarrier, &carrier));
+ EXPECT_EQ("Project Fi", carrier);
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos/network/network_state_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698