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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/components/tether/proto_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/components/tether/proto_test_util.cc
diff --git a/chromeos/components/tether/proto_test_util.cc b/chromeos/components/tether/proto_test_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..49cc9f6513e769067b3ab7e248fe34dc9cf787bd
--- /dev/null
+++ b/chromeos/components/tether/proto_test_util.cc
@@ -0,0 +1,44 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chromeos/components/tether/proto_test_util.h"
+
+namespace chromeos {
+
+namespace tether {
+
+DeviceStatus CreateTestDeviceStatus(const std::string& cell_provider_name,
+ int battery_percentage,
+ int connection_strength) {
+ // TODO(khorimoto): Once a ConnectedWifiSsid field is added as a property of
+ // Tether networks, give an option to pass a parameter for that field as well.
+ WifiStatus wifi_status;
+ wifi_status.set_status_code(
+ WifiStatus_StatusCode::WifiStatus_StatusCode_CONNECTED);
+ wifi_status.set_ssid("WifiSsid");
+
+ DeviceStatus device_status;
+ if (battery_percentage != proto_test_util::kDoNotSetIntField) {
+ device_status.set_battery_percentage(battery_percentage);
+ }
+ if (cell_provider_name != proto_test_util::kDoNotSetStringField) {
+ device_status.set_cell_provider(cell_provider_name);
+ }
+ if (connection_strength != proto_test_util::kDoNotSetIntField) {
+ device_status.set_connection_strength(connection_strength);
+ }
+
+ device_status.mutable_wifi_status()->CopyFrom(wifi_status);
+
+ return device_status;
+}
+
+DeviceStatus CreateDeviceStatusWithFakeFields() {
+ return CreateTestDeviceStatus("Google Fi", 75 /* battery_percentage */,
+ 4 /* connection_strength */);
+}
+
+} // namespace tether
+
+} // namespace chromeos
« 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