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

Side by Side Diff: chromeos/components/tether/proto_test_util.cc

Issue 2926503002: [CrOS Tether] Create proto_test_util.cc/h and move CreateTestDeviceStatus() there. (Closed)
Patch Set: Included missing dep. Created 3 years, 6 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
« no previous file with comments | « chromeos/components/tether/proto_test_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « chromeos/components/tether/proto_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698