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

Unified Diff: net/android/cellular_signal_strength_unittest.cc

Issue 1879743002: Expose cellular signal strength on Android to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Paul's comments Created 4 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: net/android/cellular_signal_strength_unittest.cc
diff --git a/net/android/cellular_signal_strength_unittest.cc b/net/android/cellular_signal_strength_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f5458d98a60a7c1d53e445238e933de000350cde
--- /dev/null
+++ b/net/android/cellular_signal_strength_unittest.cc
@@ -0,0 +1,46 @@
+// Copyright 2016 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 "net/android/cellular_signal_strength.h"
+
+#include <stdint.h>
+
+#include "net/base/network_change_notifier.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace net {
+
+namespace {
+
+TEST(CellularSignalStrengthAndroidTest, RssiTest) {
+ // This test should be run only when the device has an active cellular
+ // connection.
+ if (!NetworkChangeNotifier::IsConnectionCellular(
+ NetworkChangeNotifier::GetConnectionType())) {
+ return;
pauljensen 2016/06/10 13:52:15 if the device isn't using cellular, can we at leas
tbansal1 2016/06/16 00:58:05 Done.
+ }
+ int rssi = INT32_MIN;
bengr 2016/06/10 20:57:37 Shouldn't this be set to CellularSignalStrengthErr
tbansal1 2016/06/16 00:58:08 Done.
+ EXPECT_TRUE(android::cellular_signal_strength::GetRssiDbm(&rssi));
+ // RSSI (in dbM) should typically be between -100 and 0.
+ EXPECT_LE(-100, rssi);
+ EXPECT_GE(0, rssi);
bengr 2016/06/10 20:57:37 If you change rssi to signalStrengthDbm elsewhere,
tbansal1 2016/06/16 00:58:06 Done.
+}
+
+TEST(CellularSignalStrengthAndroidTest, SignalLevelTest) {
+ // This test should be run only when the device has an active cellular
+ // connection.
+ if (!NetworkChangeNotifier::IsConnectionCellular(
+ NetworkChangeNotifier::GetConnectionType())) {
+ return;
pauljensen 2016/06/10 13:52:15 ditto
tbansal1 2016/06/16 00:58:04 Done.
+ }
+
+ int signal_level = INT32_MIN;
+ EXPECT_TRUE(android::cellular_signal_strength::GetSignalLevel(&signal_level));
+ EXPECT_LE(0, signal_level);
+ EXPECT_GE(4, signal_level);
+}
+
+} // namespace
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698