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

Side by Side Diff: net/base/network_change_notifier_unittest.cc

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « net/base/network_change_notifier_linux.cc ('k') | net/base/network_change_notifier_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/network_change_notifier.h" 5 #include "net/base/network_change_notifier.h"
6 6
7 #include "net/base/net_util.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 namespace net { 10 namespace net {
10 11
11 // Note: This test is subject to the host's OS and network connection. This test 12 // Note: This test is subject to the host's OS and network connection. This test
12 // is not future-proof. New standards will come about necessitating the need to 13 // is not future-proof. New standards will come about necessitating the need to
13 // alter the ranges of these tests. 14 // alter the ranges of these tests.
14 TEST(NetworkChangeNotifierTest, NetMaxBandwidthRange) { 15 TEST(NetworkChangeNotifierTest, NetMaxBandwidthRange) {
15 NetworkChangeNotifier::ConnectionType connection_type = 16 NetworkChangeNotifier::ConnectionType connection_type =
16 NetworkChangeNotifier::GetConnectionType(); 17 NetworkChangeNotifier::GetConnectionType();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 case NetworkChangeNotifier::CONNECTION_NONE: 51 case NetworkChangeNotifier::CONNECTION_NONE:
51 EXPECT_EQ(0.0, max_bandwidth); 52 EXPECT_EQ(0.0, max_bandwidth);
52 break; 53 break;
53 case NetworkChangeNotifier::CONNECTION_BLUETOOTH: 54 case NetworkChangeNotifier::CONNECTION_BLUETOOTH:
54 EXPECT_GE(1.0, max_bandwidth); 55 EXPECT_GE(1.0, max_bandwidth);
55 EXPECT_LE(24.0, max_bandwidth); 56 EXPECT_LE(24.0, max_bandwidth);
56 break; 57 break;
57 } 58 }
58 } 59 }
59 60
61 TEST(NetworkChangeNotifierTest, ConnectionTypeFromInterfaceList) {
62 NetworkInterfaceList list;
63
64 // Test empty list.
65 EXPECT_EQ(NetworkChangeNotifier::ConnectionTypeFromInterfaceList(list),
66 NetworkChangeNotifier::CONNECTION_NONE);
67
68 for (int i = NetworkChangeNotifier::CONNECTION_UNKNOWN;
69 i <= NetworkChangeNotifier::CONNECTION_LAST; i++) {
70 // Check individual types.
71 NetworkInterface interface;
72 interface.type = static_cast<NetworkChangeNotifier::ConnectionType>(i);
73 list.clear();
74 list.push_back(interface);
75 EXPECT_EQ(NetworkChangeNotifier::ConnectionTypeFromInterfaceList(list), i);
76 // Check two types.
77 for (int j = NetworkChangeNotifier::CONNECTION_UNKNOWN;
78 j <= NetworkChangeNotifier::CONNECTION_LAST; j++) {
79 list.clear();
80 interface.type = static_cast<NetworkChangeNotifier::ConnectionType>(i);
81 list.push_back(interface);
82 interface.type = static_cast<NetworkChangeNotifier::ConnectionType>(j);
83 list.push_back(interface);
84 EXPECT_EQ(NetworkChangeNotifier::ConnectionTypeFromInterfaceList(list),
85 i == j ? i : NetworkChangeNotifier::CONNECTION_UNKNOWN);
86 }
87 }
88 }
89
60 } // namespace net 90 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_linux.cc ('k') | net/base/network_change_notifier_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698