diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 07:46:00 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 07:46:00 +0000 |
commit | 50b3a9e420e2a36f9aaf21d7473e027e92751eb2 (patch) | |
tree | 090ed1dd41ac8d4e739fffb545b4c9f7427a70e5 /net | |
parent | e9a40d5e6a36a441b27f03fc280d423591e00339 (diff) | |
download | chromium_src-50b3a9e420e2a36f9aaf21d7473e027e92751eb2.zip chromium_src-50b3a9e420e2a36f9aaf21d7473e027e92751eb2.tar.gz chromium_src-50b3a9e420e2a36f9aaf21d7473e027e92751eb2.tar.bz2 |
Re-enable a unittest which failed on valgrind thread sanitizer.
TSAN had reported a race on the bool |should_block_|, between BlockableProxyResolver::GetProxyForURL() and BlockableProxyResolver::Unblock().
I avoided the problem by calling WaitUntilBlocked() before Unblock(), which is the same pardigm used by the other tests.
Really, the best fix is to remove that limitation from BlockableProxyResolver... left that as a future TODO.
TBR=willchan
Review URL: http://codereview.chromium.org/561083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38195 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/proxy/single_threaded_proxy_resolver_unittest.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/proxy/single_threaded_proxy_resolver_unittest.cc b/net/proxy/single_threaded_proxy_resolver_unittest.cc index f0f5976..6d35cb4 100644 --- a/net/proxy/single_threaded_proxy_resolver_unittest.cc +++ b/net/proxy/single_threaded_proxy_resolver_unittest.cc @@ -94,6 +94,9 @@ class MockProxyResolver : public ProxyResolver { // A mock synchronous ProxyResolver which can be set to block upon reaching // GetProxyForURL(). +// TODO(eroman): WaitUntilBlocked() *must* be called before calling Unblock(), +// otherwise there will be a race on |should_block_| since it is +// read without any synchronization. class BlockableProxyResolver : public MockProxyResolver { public: BlockableProxyResolver() @@ -221,7 +224,7 @@ TEST(SingleThreadedProxyResolverTest, Basic) { // Tests that the LoadLog is updated to include the time the request was waiting // to be scheduled to a thread. -TEST(SingleThreadedProxyResolverTest, DISABLED_UpdatesLoadLogWithThreadWait) { +TEST(SingleThreadedProxyResolverTest, UpdatesLoadLogWithThreadWait) { BlockableProxyResolver* mock = new BlockableProxyResolver; SingleThreadedProxyResolver resolver(mock); @@ -257,6 +260,7 @@ TEST(SingleThreadedProxyResolverTest, DISABLED_UpdatesLoadLogWithThreadWait) { EXPECT_EQ(ERR_IO_PENDING, rv); // Unblock the worker thread so the requests can continue running. + mock->WaitUntilBlocked(); mock->Unblock(); // Check that request 0 completed as expected. |