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("WifiSsid"); |
| 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 DeviceStatus CreateDeviceStatusWithFakeFields() { |
| 38 return CreateTestDeviceStatus("Google Fi", 75 /* battery_percentage */, |
| 39 4 /* connection_strength */); |
| 40 } |
| 41 |
| 42 } // namespace tether |
| 43 |
| 44 } // namespace chromeos |
OLD | NEW |