| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014, Google Inc. All rights reserved. | 2 * Copyright (c) 2014, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 namespace { | 48 namespace { |
| 49 const double kNoneMaxBandwidthMbps = 0.0; | 49 const double kNoneMaxBandwidthMbps = 0.0; |
| 50 const double kBluetoothMaxBandwidthMbps = 1.0; | 50 const double kBluetoothMaxBandwidthMbps = 1.0; |
| 51 const double kEthernetMaxBandwidthMbps = 2.0; | 51 const double kEthernetMaxBandwidthMbps = 2.0; |
| 52 const Optional<TimeDelta> kEthernetHttpRtt(TimeDelta::FromMilliseconds(50)); | 52 const Optional<TimeDelta> kEthernetHttpRtt(TimeDelta::FromMilliseconds(50)); |
| 53 const Optional<TimeDelta> kEthernetTransportRtt( | 53 const Optional<TimeDelta> kEthernetTransportRtt( |
| 54 TimeDelta::FromMilliseconds(25)); | 54 TimeDelta::FromMilliseconds(25)); |
| 55 const Optional<double> kEthernetThroughputMbps(75.0); | 55 const Optional<double> kEthernetThroughputMbps(75.0); |
| 56 const Optional<TimeDelta> kUnknownRtt; | 56 const Optional<TimeDelta> kUnknownRtt; |
| 57 const Optional<double> kUnknownThroughputMbps; | 57 const Optional<double> kUnknownThroughputMbps; |
| 58 } | 58 } // namespace |
| 59 | 59 |
| 60 class StateObserver : public NetworkStateNotifier::NetworkStateObserver { | 60 class StateObserver : public NetworkStateNotifier::NetworkStateObserver { |
| 61 public: | 61 public: |
| 62 StateObserver() | 62 StateObserver() |
| 63 : observed_type_(kWebConnectionTypeNone), | 63 : observed_type_(kWebConnectionTypeNone), |
| 64 observed_max_bandwidth_mbps_(0.0), | 64 observed_max_bandwidth_mbps_(0.0), |
| 65 observed_effective_type_(WebEffectiveConnectionType::kTypeUnknown), | 65 observed_effective_type_(WebEffectiveConnectionType::kTypeUnknown), |
| 66 observed_http_rtt_(kUnknownRtt), | 66 observed_http_rtt_(kUnknownRtt), |
| 67 observed_transport_rtt_(kUnknownRtt), | 67 observed_transport_rtt_(kUnknownRtt), |
| 68 observed_downlink_throughput_mbps_(kUnknownThroughputMbps), | 68 observed_downlink_throughput_mbps_(kUnknownThroughputMbps), |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 WebEffectiveConnectionType::kType3G, kEthernetHttpRtt, | 787 WebEffectiveConnectionType::kType3G, kEthernetHttpRtt, |
| 788 kEthernetTransportRtt, kEthernetThroughputMbps)); | 788 kEthernetTransportRtt, kEthernetThroughputMbps)); |
| 789 EXPECT_EQ(observer1.CallbackCount(), 3); | 789 EXPECT_EQ(observer1.CallbackCount(), 3); |
| 790 EXPECT_EQ(observer2.CallbackCount(), 5); | 790 EXPECT_EQ(observer2.CallbackCount(), 5); |
| 791 | 791 |
| 792 notifier_.RemoveConnectionObserver(&observer1, GetTaskRunner()); | 792 notifier_.RemoveConnectionObserver(&observer1, GetTaskRunner()); |
| 793 notifier_.RemoveConnectionObserver(&observer2, GetTaskRunner()); | 793 notifier_.RemoveConnectionObserver(&observer2, GetTaskRunner()); |
| 794 } | 794 } |
| 795 | 795 |
| 796 } // namespace blink | 796 } // namespace blink |
| OLD | NEW |