diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-03 13:42:47 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:27:51 +0000 |
commit | 8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (patch) | |
tree | d29d987c4d7b173cf853279b79a51598f104b403 /chromium/net/http/broken_alternative_services_unittest.cc | |
parent | 830c9e163d31a9180fadca926b3e1d7dfffb5021 (diff) | |
download | qtwebengine-chromium-8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec.tar.gz |
BASELINE: Update Chromium to 66.0.3359.156
Change-Id: I0c9831ad39911a086b6377b16f995ad75a51e441
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/net/http/broken_alternative_services_unittest.cc')
-rw-r--r-- | chromium/net/http/broken_alternative_services_unittest.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/chromium/net/http/broken_alternative_services_unittest.cc b/chromium/net/http/broken_alternative_services_unittest.cc index 5b5513801bd..341419d0d69 100644 --- a/chromium/net/http/broken_alternative_services_unittest.cc +++ b/chromium/net/http/broken_alternative_services_unittest.cc @@ -137,6 +137,46 @@ TEST_F(BrokenAlternativeServicesTest, ExpireBrokenAlternateProtocolMappings) { alternative_service)); } +TEST_F(BrokenAlternativeServicesTest, IsAlternativeServiceBroken) { + // Tests the IsAlternativeServiceBroken() methods. + AlternativeService alternative_service(kProtoQUIC, "foo", 443); + base::TimeTicks brokenness_expiration; + + EXPECT_FALSE( + broken_services_.IsAlternativeServiceBroken(alternative_service)); + EXPECT_FALSE(broken_services_.IsAlternativeServiceBroken( + alternative_service, &brokenness_expiration)); + + broken_services_.MarkAlternativeServiceBroken(alternative_service); + EXPECT_TRUE(broken_services_.IsAlternativeServiceBroken(alternative_service)); + EXPECT_TRUE(broken_services_.IsAlternativeServiceBroken( + alternative_service, &brokenness_expiration)); + EXPECT_EQ( + broken_services_clock_->NowTicks() + base::TimeDelta::FromMinutes(5), + brokenness_expiration); + + // Fast forward time until |alternative_service|'s brokenness expires. + test_task_runner_->FastForwardBy(base::TimeDelta::FromMinutes(5)); + EXPECT_FALSE( + broken_services_.IsAlternativeServiceBroken(alternative_service)); + EXPECT_FALSE(broken_services_.IsAlternativeServiceBroken( + alternative_service, &brokenness_expiration)); + + broken_services_.MarkAlternativeServiceBroken(alternative_service); + EXPECT_TRUE(broken_services_.IsAlternativeServiceBroken(alternative_service)); + EXPECT_TRUE(broken_services_.IsAlternativeServiceBroken( + alternative_service, &brokenness_expiration)); + EXPECT_EQ( + broken_services_clock_->NowTicks() + base::TimeDelta::FromMinutes(10), + brokenness_expiration); + + broken_services_.ConfirmAlternativeService(alternative_service); + EXPECT_FALSE( + broken_services_.IsAlternativeServiceBroken(alternative_service)); + EXPECT_FALSE(broken_services_.IsAlternativeServiceBroken( + alternative_service, &brokenness_expiration)); +} + TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff) { // Tests the exponential backoff of the computed expiration delay when an // alt svc is marked broken. After being marked broken 10 times, the max |