| 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 kUnknownThroughputMbps)); | 526 kUnknownThroughputMbps)); |
| 527 EXPECT_TRUE(notifier_.OnLine()); | 527 EXPECT_TRUE(notifier_.OnLine()); |
| 528 EXPECT_EQ(kWebConnectionTypeBluetooth, notifier_.ConnectionType()); | 528 EXPECT_EQ(kWebConnectionTypeBluetooth, notifier_.ConnectionType()); |
| 529 EXPECT_EQ(kBluetoothMaxBandwidthMbps, notifier_.MaxBandwidth()); | 529 EXPECT_EQ(kBluetoothMaxBandwidthMbps, notifier_.MaxBandwidth()); |
| 530 | 530 |
| 531 notifier_.SetOverride(true, kWebConnectionTypeEthernet, | 531 notifier_.SetOverride(true, kWebConnectionTypeEthernet, |
| 532 kEthernetMaxBandwidthMbps); | 532 kEthernetMaxBandwidthMbps); |
| 533 RunPendingTasks(); | 533 RunPendingTasks(); |
| 534 EXPECT_TRUE(VerifyObservations( | 534 EXPECT_TRUE(VerifyObservations( |
| 535 observer, kWebConnectionTypeEthernet, kEthernetMaxBandwidthMbps, | 535 observer, kWebConnectionTypeEthernet, kEthernetMaxBandwidthMbps, |
| 536 WebEffectiveConnectionType::kTypeUnknown, kUnknownRtt, kUnknownRtt, | 536 WebEffectiveConnectionType::kTypeUnknown, base::TimeDelta::FromSeconds(1), |
| 537 kUnknownThroughputMbps)); | 537 base::TimeDelta::FromSeconds(1), 1)); |
| 538 EXPECT_TRUE(notifier_.OnLine()); | 538 EXPECT_TRUE(notifier_.OnLine()); |
| 539 EXPECT_EQ(kWebConnectionTypeEthernet, notifier_.ConnectionType()); | 539 EXPECT_EQ(kWebConnectionTypeEthernet, notifier_.ConnectionType()); |
| 540 EXPECT_EQ(kEthernetMaxBandwidthMbps, notifier_.MaxBandwidth()); | 540 EXPECT_EQ(kEthernetMaxBandwidthMbps, notifier_.MaxBandwidth()); |
| 541 | 541 |
| 542 // When override is active, calls to setOnLine and setConnection are temporary | 542 // When override is active, calls to setOnLine and setConnection are temporary |
| 543 // ignored. | 543 // ignored. |
| 544 notifier_.SetOnLine(false); | 544 notifier_.SetOnLine(false); |
| 545 SetConnection(kWebConnectionTypeNone, kNoneMaxBandwidthMbps, | 545 SetConnection(kWebConnectionTypeNone, kNoneMaxBandwidthMbps, |
| 546 WebEffectiveConnectionType::kTypeUnknown, kUnknownRtt, | 546 WebEffectiveConnectionType::kTypeUnknown, kUnknownRtt, |
| 547 kUnknownRtt, kUnknownThroughputMbps); | 547 kUnknownRtt, kUnknownThroughputMbps); |
| 548 RunPendingTasks(); | 548 RunPendingTasks(); |
| 549 EXPECT_TRUE(VerifyObservations( | 549 EXPECT_TRUE(VerifyObservations( |
| 550 observer, kWebConnectionTypeEthernet, kEthernetMaxBandwidthMbps, | 550 observer, kWebConnectionTypeEthernet, kEthernetMaxBandwidthMbps, |
| 551 WebEffectiveConnectionType::kTypeUnknown, kUnknownRtt, kUnknownRtt, | 551 WebEffectiveConnectionType::kTypeUnknown, base::TimeDelta::FromSeconds(1), |
| 552 kUnknownThroughputMbps)); | 552 base::TimeDelta::FromSeconds(1), 1)); |
| 553 EXPECT_TRUE(notifier_.OnLine()); | 553 EXPECT_TRUE(notifier_.OnLine()); |
| 554 EXPECT_EQ(kWebConnectionTypeEthernet, notifier_.ConnectionType()); | 554 EXPECT_EQ(kWebConnectionTypeEthernet, notifier_.ConnectionType()); |
| 555 EXPECT_EQ(kEthernetMaxBandwidthMbps, notifier_.MaxBandwidth()); | 555 EXPECT_EQ(kEthernetMaxBandwidthMbps, notifier_.MaxBandwidth()); |
| 556 | 556 |
| 557 notifier_.ClearOverride(); | 557 notifier_.ClearOverride(); |
| 558 RunPendingTasks(); | 558 RunPendingTasks(); |
| 559 EXPECT_TRUE(VerifyObservations( | 559 EXPECT_TRUE(VerifyObservations( |
| 560 observer, kWebConnectionTypeNone, kNoneMaxBandwidthMbps, | 560 observer, kWebConnectionTypeNone, kNoneMaxBandwidthMbps, |
| 561 WebEffectiveConnectionType::kTypeUnknown, kUnknownRtt, kUnknownRtt, | 561 WebEffectiveConnectionType::kTypeUnknown, kUnknownRtt, kUnknownRtt, |
| 562 kUnknownThroughputMbps)); | 562 kUnknownThroughputMbps)); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 WebEffectiveConnectionType::kType3G, kEthernetHttpRtt, | 702 WebEffectiveConnectionType::kType3G, kEthernetHttpRtt, |
| 703 kEthernetTransportRtt, kEthernetThroughputMbps)); | 703 kEthernetTransportRtt, kEthernetThroughputMbps)); |
| 704 EXPECT_EQ(observer1.CallbackCount(), 3); | 704 EXPECT_EQ(observer1.CallbackCount(), 3); |
| 705 EXPECT_EQ(observer2.CallbackCount(), 5); | 705 EXPECT_EQ(observer2.CallbackCount(), 5); |
| 706 | 706 |
| 707 notifier_.RemoveConnectionObserver(&observer1, GetTaskRunner()); | 707 notifier_.RemoveConnectionObserver(&observer1, GetTaskRunner()); |
| 708 notifier_.RemoveConnectionObserver(&observer2, GetTaskRunner()); | 708 notifier_.RemoveConnectionObserver(&observer2, GetTaskRunner()); |
| 709 } | 709 } |
| 710 | 710 |
| 711 } // namespace blink | 711 } // namespace blink |
| OLD | NEW |