| OLD | NEW |
| 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/network_interfaces.h" | 7 #include "net/base/network_interfaces.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 // 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 |
| 13 // 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 |
| 14 // alter the ranges of these tests. | 14 // alter the ranges of these tests. |
| 15 TEST(NetworkChangeNotifierTest, NetMaxBandwidthRange) { | 15 TEST(NetworkChangeNotifierTest, NetMaxBandwidthRange) { |
| 16 NetworkChangeNotifier::ConnectionType connection_type = | 16 NetworkChangeNotifier::ConnectionType connection_type = |
| 17 NetworkChangeNotifier::GetConnectionType(); | 17 NetworkChangeNotifier::CONNECTION_NONE; |
| 18 double max_bandwidth = NetworkChangeNotifier::GetMaxBandwidth(); | 18 double max_bandwidth = 0.0; |
| 19 NetworkChangeNotifier::GetMaxBandwidthAndConnectionType(&max_bandwidth, |
| 20 &connection_type); |
| 19 | 21 |
| 20 // Always accept infinity as it's the default value if the bandwidth is | 22 // Always accept infinity as it's the default value if the bandwidth is |
| 21 // unknown. | 23 // unknown. |
| 22 if (max_bandwidth == std::numeric_limits<double>::infinity()) { | 24 if (max_bandwidth == std::numeric_limits<double>::infinity()) { |
| 23 EXPECT_NE(NetworkChangeNotifier::CONNECTION_NONE, connection_type); | 25 EXPECT_NE(NetworkChangeNotifier::CONNECTION_NONE, connection_type); |
| 24 return; | 26 return; |
| 25 } | 27 } |
| 26 | 28 |
| 27 switch (connection_type) { | 29 switch (connection_type) { |
| 28 case NetworkChangeNotifier::CONNECTION_UNKNOWN: | 30 case NetworkChangeNotifier::CONNECTION_UNKNOWN: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 interface_vmnet_win.type = NetworkChangeNotifier::CONNECTION_ETHERNET; | 117 interface_vmnet_win.type = NetworkChangeNotifier::CONNECTION_ETHERNET; |
| 116 interface_vmnet_win.name = "virtualdevice"; | 118 interface_vmnet_win.name = "virtualdevice"; |
| 117 interface_vmnet_win.friendly_name = "VMware Network Adapter VMnet1"; | 119 interface_vmnet_win.friendly_name = "VMware Network Adapter VMnet1"; |
| 118 list.push_back(interface_vmnet_win); | 120 list.push_back(interface_vmnet_win); |
| 119 | 121 |
| 120 EXPECT_EQ(NetworkChangeNotifier::CONNECTION_NONE, | 122 EXPECT_EQ(NetworkChangeNotifier::CONNECTION_NONE, |
| 121 NetworkChangeNotifier::ConnectionTypeFromInterfaceList(list)); | 123 NetworkChangeNotifier::ConnectionTypeFromInterfaceList(list)); |
| 122 } | 124 } |
| 123 | 125 |
| 124 } // namespace net | 126 } // namespace net |
| OLD | NEW |