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

Side by Side Diff: chromeos/network/network_state_unittest.cc

Issue 2844363003: [CrOS Tether] Add HasConnectedToHost property for Tether networks. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/network/network_state.h" 5 #include "chromeos/network/network_state.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 network_state_.set_connection_state(shill::kStateConfiguration); 255 network_state_.set_connection_state(shill::kStateConfiguration);
256 EXPECT_EQ(network_state_.connection_state(), shill::kStateDisconnect); 256 EXPECT_EQ(network_state_.connection_state(), shill::kStateDisconnect);
257 EXPECT_FALSE(network_state_.IsConnectingState()); 257 EXPECT_FALSE(network_state_.IsConnectingState());
258 EXPECT_FALSE(network_state_.IsReconnecting()); 258 EXPECT_FALSE(network_state_.IsReconnecting());
259 } 259 }
260 260
261 TEST_F(NetworkStateTest, TetherProperties) { 261 TEST_F(NetworkStateTest, TetherProperties) {
262 network_state_.set_type(kTypeTether); 262 network_state_.set_type(kTypeTether);
263 network_state_.set_carrier("Project Fi"); 263 network_state_.set_carrier("Project Fi");
264 network_state_.set_battery_percentage(85); 264 network_state_.set_battery_percentage(85);
265 network_state_.set_has_connected_as_tether_client(true);
265 network_state_.set_signal_strength(75); 266 network_state_.set_signal_strength(75);
266 267
267 base::DictionaryValue dictionary; 268 base::DictionaryValue dictionary;
268 network_state_.GetStateProperties(&dictionary); 269 network_state_.GetStateProperties(&dictionary);
269 270
270 int signal_strength; 271 int signal_strength;
271 EXPECT_TRUE(dictionary.GetIntegerWithoutPathExpansion(kTetherSignalStrength, 272 EXPECT_TRUE(dictionary.GetIntegerWithoutPathExpansion(kTetherSignalStrength,
272 &signal_strength)); 273 &signal_strength));
273 EXPECT_EQ(75, signal_strength); 274 EXPECT_EQ(75, signal_strength);
274 275
275 int battery_percentage; 276 int battery_percentage;
276 EXPECT_TRUE(dictionary.GetIntegerWithoutPathExpansion( 277 EXPECT_TRUE(dictionary.GetIntegerWithoutPathExpansion(
277 kTetherBatteryPercentage, &battery_percentage)); 278 kTetherBatteryPercentage, &battery_percentage));
278 EXPECT_EQ(85, battery_percentage); 279 EXPECT_EQ(85, battery_percentage);
279 280
281 bool has_connected_as_tether_client;
282 EXPECT_TRUE(dictionary.GetBooleanWithoutPathExpansion(
283 kTetherHasConnectedToHost, &has_connected_as_tether_client));
284 EXPECT_TRUE(has_connected_as_tether_client);
285
280 std::string carrier; 286 std::string carrier;
281 EXPECT_TRUE( 287 EXPECT_TRUE(
282 dictionary.GetStringWithoutPathExpansion(kTetherCarrier, &carrier)); 288 dictionary.GetStringWithoutPathExpansion(kTetherCarrier, &carrier));
283 EXPECT_EQ("Project Fi", carrier); 289 EXPECT_EQ("Project Fi", carrier);
284 } 290 }
285 291
286 } // namespace chromeos 292 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698