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

Unified Diff: Source/modules/websockets/WebSocket.h

Issue 298893008: Add WebSocket unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
Index: Source/modules/websockets/WebSocket.h
diff --git a/Source/modules/websockets/WebSocket.h b/Source/modules/websockets/WebSocket.h
index f48c0b52c105b1372df80e3e0d47200ecb617a9b..9b9b36727fde96d2fb3361612ba6792a6831f249 100644
--- a/Source/modules/websockets/WebSocket.h
+++ b/Source/modules/websockets/WebSocket.h
@@ -51,10 +51,10 @@ namespace WebCore {
class Blob;
class ExceptionState;
-class WebSocket FINAL : public RefCountedWillBeRefCountedGarbageCollected<WebSocket>, public ScriptWrappable, public EventTargetWithInlineData, public ActiveDOMObject, public WebSocketChannelClient {
+class WebSocket : public RefCountedWillBeRefCountedGarbageCollected<WebSocket>, public ScriptWrappable, public EventTargetWithInlineData, public ActiveDOMObject, public WebSocketChannelClient {
DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<WebSocket>);
public:
- static const char* subProtocolSeperator();
+ static const char* subprotocolSeperator();
// WebSocket instances must be used with a wrapper since this class's
// lifetime management is designed assuming the V8 holds a ref on it while
// hasPendingActivity() returns true.
@@ -123,7 +123,12 @@ public:
virtual void didStartClosingHandshake() OVERRIDE;
virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const String& reason) OVERRIDE;
- void trace(Visitor*);
+ virtual void trace(Visitor*);
+
+ static bool isValidSubprotocolString(const String&);
+
+protected:
+ explicit WebSocket(ExecutionContext*);
private:
// FIXME: This should inherit WebCore::EventQueue.
@@ -176,7 +181,12 @@ private:
WebSocketSendTypeMax,
};
- explicit WebSocket(ExecutionContext*);
+ // This function is virtual for unittests.
+ // FIXME: Move WebSocketChannel::create here.
+ virtual PassRefPtrWillBeRawPtr<WebSocketChannel> createChannel(ExecutionContext* context, WebSocketChannelClient* client)
+ {
+ return WebSocketChannel::create(context, client);
+ }
// Adds a console message with JSMessageSource and ErrorMessageLevel.
void logError(const String& message);

Powered by Google App Engine
This is Rietveld 408576698