commit | 6f75c0f495ac7358e0bab2aa180ed90f32691917 | [log] [tgz] |
---|---|---|
author | Adam Rice <ricea@chromium.org> | Mon Jun 04 08:00:05 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Mon Jun 04 08:00:05 2018 |
tree | 3c83a62b919e80a986e2b6e70f556cbd62c45876 | |
parent | 4040a4d9004dd3258db0b9abea5c66757987bb5e [diff] |
Change the way SetWebSocketKeyForTesting is called Previously SetWebSocketKeyForTesting() was called from TestWebSocketHandshakeStreamCreateHelper::OnBasicStreamCreated(). However, in future a WebSocketBasicHandshakeStream object will need to recreate itself inside WebSocketBasicHandshakeStream::RenewStreamForAuth(). That method doesn't have access to the WebSocketHandshakeStreamCreateHelper object to call OnBasicStreamCreated(). Remove WebSocketHandshakeStreamCreateHelper::OnBasicStreamCreated() and instead split WebSocketStreamRequest::OnHandshakeStreamCreated() into two methods, OnBasicHandshakeStreamCreated() and OnHttp2HandshakeStreamCreated(). During normal execution they do the same thing, but in tests OnBasicHandshakeStreamCreated() calls SetWebSocketKeyForTesting(). This is not needed for the Http2 variant as the H2/WS protocol does not use this header. Also, move OnBasicHandshakeStreamCreated(), OnHttp2HandshakeStreamCreated() and OnFailure() methods from WebSocketStreamRequest to a new subclass, WebSocketStreamRequestAPI. It doesn't make sense to expose these methods to the caller of WebSocketStream::CreateAndConnectStream(). WebSocketStreamRequestAPI is used in place of the base class inside the handshake implementation. CreateAndConnectStreamForTesting() has to use the real WebSocketStreamRequestImpl implementation and so cannot call SetWebSocketKeyForTesting() directly. Instead, add a new parameter to CreateAndConnectStreamForTesting(), |api_delegate|, providing an object which WebSocketStreamRequestImpl calls for the methods on WebSocketStreamRequestAPI. This is used by WebSocketStreamCreateTestBase::CreateAndConnectStream() to inject a TestWebSocketStreamRequestAPI object. DummyWebSocketStreamRequest is renamed TestWebSocketStreamRequestAPI as now that it calls SetWebSocketKeyForTesting() it is no longer just a dummy object but actually does something. BUG=423609 Change-Id: I5ed12ef2097f2bfc500b20f394e0da46234d4fd5 Reviewed-on: https://chromium-review.googlesource.com/1077868 Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Commit-Queue: Adam Rice <ricea@chromium.org> Cr-Commit-Position: refs/heads/master@{#564013}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .