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

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: 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
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..0cd0f394d4218eebf9e877a18988ffda37155037
--- /dev/null
+++ b/chromeos/components/tether/proto_test_util.cc
@@ -0,0 +1,39 @@
+// 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("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.
+
+ 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;
+}
+
+} // namespace tether
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698