Use PlaybackToMemory for BitmapRasterWorkerPool playback
[chromium-blink-merge.git] / net / base / network_change_notifier_unittest.cc
blobb8310fa5b7f63b2c656bd63daf65c83c7d1952e5
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
3 // found in the LICENSE file.
5 #include "net/base/network_change_notifier.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace net {
11 // 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 // alter the ranges of these tests.
14 TEST(NetworkChangeNotifierTest, NetMaxBandwidthRange) {
15 NetworkChangeNotifier::ConnectionType connection_type =
16 NetworkChangeNotifier::GetConnectionType();
17 double max_bandwidth = NetworkChangeNotifier::GetMaxBandwidth();
19 // Always accept infinity as it's the default value if the bandwidth is
20 // unknown.
21 if (max_bandwidth == std::numeric_limits<double>::infinity()) {
22 EXPECT_NE(NetworkChangeNotifier::CONNECTION_NONE, connection_type);
23 return;
26 switch (connection_type) {
27 case NetworkChangeNotifier::CONNECTION_UNKNOWN:
28 EXPECT_EQ(std::numeric_limits<double>::infinity(), max_bandwidth);
29 break;
30 case NetworkChangeNotifier::CONNECTION_ETHERNET:
31 EXPECT_GE(10.0, max_bandwidth);
32 EXPECT_LE(10000.0, max_bandwidth);
33 break;
34 case NetworkChangeNotifier::CONNECTION_WIFI:
35 EXPECT_GE(1.0, max_bandwidth);
36 EXPECT_LE(7000.0, max_bandwidth);
37 break;
38 case NetworkChangeNotifier::CONNECTION_2G:
39 EXPECT_GE(0.01, max_bandwidth);
40 EXPECT_LE(0.384, max_bandwidth);
41 break;
42 case NetworkChangeNotifier::CONNECTION_3G:
43 EXPECT_GE(2.0, max_bandwidth);
44 EXPECT_LE(42.0, max_bandwidth);
45 break;
46 case NetworkChangeNotifier::CONNECTION_4G:
47 EXPECT_GE(100.0, max_bandwidth);
48 EXPECT_LE(100.0, max_bandwidth);
49 break;
50 case NetworkChangeNotifier::CONNECTION_NONE:
51 EXPECT_EQ(0.0, max_bandwidth);
52 break;
53 case NetworkChangeNotifier::CONNECTION_BLUETOOTH:
54 EXPECT_GE(1.0, max_bandwidth);
55 EXPECT_LE(24.0, max_bandwidth);
56 break;
60 } // namespace net