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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 "net/android/cellular_signal_strength.h"
6
7 #include <stdint.h>
8
9 #include "net/base/network_change_notifier.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace net {
13
14 namespace {
15
16 TEST(CellularSignalStrengthAndroidTest, RssiTest) {
17 // This test should be run only when the device has an active cellular
18 // connection.
19 if (!NetworkChangeNotifier::IsConnectionCellular(
20 NetworkChangeNotifier::GetConnectionType())) {
21 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.
22 }
23 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.
24 EXPECT_TRUE(android::cellular_signal_strength::GetRssiDbm(&rssi));
25 // RSSI (in dbM) should typically be between -100 and 0.
26 EXPECT_LE(-100, rssi);
27 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.
28 }
29
30 TEST(CellularSignalStrengthAndroidTest, SignalLevelTest) {
31 // This test should be run only when the device has an active cellular
32 // connection.
33 if (!NetworkChangeNotifier::IsConnectionCellular(
34 NetworkChangeNotifier::GetConnectionType())) {
35 return;
pauljensen 2016/06/10 13:52:15 ditto
tbansal1 2016/06/16 00:58:04 Done.
36 }
37
38 int signal_level = INT32_MIN;
39 EXPECT_TRUE(android::cellular_signal_strength::GetSignalLevel(&signal_level));
40 EXPECT_LE(0, signal_level);
41 EXPECT_GE(4, signal_level);
42 }
43
44 } // namespace
45
46 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698