OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chromeos/components/tether/proto_test_util.h" | |
6 | |
7 namespace chromeos { | |
8 | |
9 namespace tether { | |
10 | |
11 DeviceStatus CreateTestDeviceStatus(const std::string& cell_provider_name, | |
12 int battery_percentage, | |
13 int connection_strength) { | |
14 // TODO(khorimoto): Once a ConnectedWifiSsid field is added as a property of | |
15 // Tether networks, give an option to pass a parameter for that field as well. | |
16 WifiStatus wifi_status; | |
17 wifi_status.set_status_code( | |
18 WifiStatus_StatusCode::WifiStatus_StatusCode_CONNECTED); | |
19 wifi_status.set_ssid("Google A"); | |
Ryan Hansberry
2017/06/05 22:52:23
nit: use a non-Google specific string, e.g. "WifiS
Kyle Horimoto
2017/06/05 23:18:56
Done.
| |
20 | |
21 DeviceStatus device_status; | |
22 if (battery_percentage != proto_test_util::kDoNotSetIntField) { | |
23 device_status.set_battery_percentage(battery_percentage); | |
24 } | |
25 if (cell_provider_name != proto_test_util::kDoNotSetStringField) { | |
26 device_status.set_cell_provider(cell_provider_name); | |
27 } | |
28 if (connection_strength != proto_test_util::kDoNotSetIntField) { | |
29 device_status.set_connection_strength(connection_strength); | |
30 } | |
31 | |
32 device_status.mutable_wifi_status()->CopyFrom(wifi_status); | |
33 | |
34 return device_status; | |
35 } | |
36 | |
37 } // namespace tether | |
38 | |
39 } // namespace chromeos | |
OLD | NEW |