Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: net/socket_stream/socket_stream_unittest.cc

Issue 16870008: Revert a workaround commit for a UAF crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket_stream/socket_stream.cc ('k') | net/url_request/url_request_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket_stream/socket_stream_unittest.cc
diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc
index 212f88eddc67dab611e3eb74d2402d12c049e99a..bd0a348b0ef0f028c976ada271843247dc81d056 100644
--- a/net/socket_stream/socket_stream_unittest.cc
+++ b/net/socket_stream/socket_stream_unittest.cc
@@ -962,66 +962,4 @@ TEST_F(SocketStreamTest, OnErrorDetachDelegate) {
EXPECT_EQ(OK, test_callback.WaitForResult());
}
-// A test for the WeakPtr workaround patch which should be deleted
-// in the future.
-TEST_F(SocketStreamTest, ContextDestroyedBeforeDoBeforeConnect) {
- TestCompletionCallback test_callback;
-
- scoped_ptr<SocketStreamEventRecorder> delegate(
- new SocketStreamEventRecorder(test_callback.callback()));
-
- scoped_ptr<TestURLRequestContext> context(new TestURLRequestContext);
- TestSocketStreamNetworkDelegate network_delegate;
- network_delegate.SetBeforeConnectResult(OK);
- context->set_network_delegate(&network_delegate);
-
- scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
-
- socket_stream->set_context(context.get());
-
- socket_stream->Connect();
- context.reset();
-
- ASSERT_EQ(0U, delegate->GetSeenEvents().size());
-
- test_callback.WaitForResult();
-
- const std::vector<SocketStreamEvent>& events = delegate->GetSeenEvents();
- ASSERT_EQ(1U, events.size());
-
- EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[0].event_type);
-}
-
-// A test for the WeakPtr workaround patch which should be deleted
-// in the future.
-TEST_F(SocketStreamTest, SocketStreamResetBeforeDoBeforeConnect) {
- TestCompletionCallback test_callback;
-
- scoped_ptr<SocketStreamEventRecorder> delegate(
- new SocketStreamEventRecorder(test_callback.callback()));
-
- scoped_ptr<TestURLRequestContext> context(new TestURLRequestContext);
- TestSocketStreamNetworkDelegate network_delegate;
- network_delegate.SetBeforeConnectResult(OK);
- context->set_network_delegate(&network_delegate);
-
- scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
-
- socket_stream->set_context(context.get());
-
- socket_stream->Connect();
- socket_stream = NULL;
- context.reset();
-
- ASSERT_EQ(0U, delegate->GetSeenEvents().size());
- test_callback.WaitForResult();
-
- const std::vector<SocketStreamEvent>& events = delegate->GetSeenEvents();
- ASSERT_EQ(1U, events.size());
-
- EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[0].event_type);
-}
-
} // namespace net
« no previous file with comments | « net/socket_stream/socket_stream.cc ('k') | net/url_request/url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698