Commit 4cbbe2d8 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

Make ScopedTaskEnvironment the first member of QuicHttpProxyBackendStreamTest.

The documentation for ScopedTaskEnvironment recommends making it the
first member of the test fixture:
  https://cs.chromium.org/chromium/src/base/test/scoped_task_environment.h?l=54-59&rcl=376db7a96e0287f0d010acd18e7a379d190cac71

We are chaning this particular case because we want to make the
constructor of ScopedTaskEnvironment set a global variable that is
read by PlatformThread::SetCurrentThreadPriority(). If
ScopedTaskEnvironment is initialized late in the test execution,
setting this global variable races with a call to
PlatfromThread::SetCurrentThreadPriority() on the thread created
from this stack:
  base::(anonymous namespace)::CreateThread
  base::PlatformThread::CreateWithPriority
  base::Thread::StartWithOptions
  net::test::QuicHttpProxyBackendStreamTest::CreateTestBackendProxy
  net::test::QuicHttpProxyBackendStreamTest::SetUp

Bug: 902441
Change-Id: I4869410f43383bd7f94f68fc7790e3305f3d1b4a
Reviewed-on: https://chromium-review.googlesource.com/c/1320654
Commit-Queue: François Doray <fdoray@chromium.org>
Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606259}
parent 930c435d
......@@ -136,7 +136,6 @@ class TestQuicServerStreamDelegate
bool send_success_;
bool did_complete_;
std::unique_ptr<QuicHttpProxyBackendStream> quic_backend_stream_;
base::test::ScopedTaskEnvironment scoped_task_environment;
const scoped_refptr<base::SingleThreadTaskRunner> task_runner_ =
base::ThreadTaskRunnerHandle::Get();
base::RunLoop run_loop_;
......@@ -185,6 +184,7 @@ class QuicHttpProxyBackendStreamTest : public QuicTest {
}
protected:
base::test::ScopedTaskEnvironment scoped_task_environment_;
std::string backend_url_;
std::unique_ptr<QuicHttpProxyBackend> proxy_backend_;
std::unique_ptr<QuicHttpProxyBackend> proxy_backend_fail_;
......@@ -479,4 +479,4 @@ TEST_F(QuicHttpProxyBackendStreamTest, SendRequestToBackendHopHeaders) {
}
} // namespace test
} // namespace net
\ No newline at end of file
} // namespace net
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment