From e95d1653ac428691116950e45d6eb6b56b1d32ee Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 23 Aug 2022 13:40:03 -0400 Subject: [PATCH] tests: Fix failures on multiple execution of HSTSRedirectTest.Redirect (see issue #3336) --- tests/ceftests/hsts_redirect_unittest.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/ceftests/hsts_redirect_unittest.cc b/tests/ceftests/hsts_redirect_unittest.cc index 5577109e1..218ba16d8 100644 --- a/tests/ceftests/hsts_redirect_unittest.cc +++ b/tests/ceftests/hsts_redirect_unittest.cc @@ -7,6 +7,7 @@ #include "tests/ceftests/test_handler.h" #include "tests/ceftests/test_server.h" #include "tests/ceftests/test_server_observer.h" +#include "tests/ceftests/test_util.h" #include "tests/gtest/include/gtest/gtest.h" #include "tests/shared/common/string_util.h" @@ -261,7 +262,11 @@ class HSTSRedirectTest : public TestHandler { https_url_ = url; EXPECT_TRUE(https_url_.find("https://localhost:") == 0); - CreateBrowser(http_url_); + // Create a new in-memory context so HSTS decisions aren't cached. + auto request_context = CreateTestRequestContext( + TEST_RC_MODE_CUSTOM, /*cache_path=*/std::string()); + + CreateBrowser(http_url_, request_context); } void StopHttpServer() {