X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fmodules%2Fwebsockets%2FDOMWebSocketTest.cpp;h=dc6e001f2e4536793359ab59e6ef60c7b94ef4c8;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=020923bb6197661a8afc90deef96bebe8e6039ba;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp b/src/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp index 020923b..dc6e001 100644 --- a/src/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp +++ b/src/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp @@ -3,19 +3,17 @@ // found in the LICENSE file. #include "config.h" - #include "modules/websockets/DOMWebSocket.h" #include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/V8Binding.h" +#include "core/dom/DOMTypedArray.h" #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" #include "core/fileapi/Blob.h" #include "core/frame/ConsoleTypes.h" #include "core/testing/DummyPageHolder.h" -#include "wtf/ArrayBuffer.h" #include "wtf/OwnPtr.h" -#include "wtf/Uint8Array.h" #include "wtf/Vector.h" #include "wtf/testing/WTFTestHelpers.h" #include "wtf/text/WTFString.h" @@ -39,7 +37,7 @@ class MockWebSocketChannel : public WebSocketChannel { public: static MockWebSocketChannel* create() { - return adoptRefCountedGarbageCollected(new testing::StrictMock()); + return new testing::StrictMock(); } virtual ~MockWebSocketChannel() @@ -63,25 +61,25 @@ public: } }; -class DOMWebSocketWithMockChannel FINAL : public DOMWebSocket { +class DOMWebSocketWithMockChannel final : public DOMWebSocket { public: static DOMWebSocketWithMockChannel* create(ExecutionContext* context) { - DOMWebSocketWithMockChannel* websocket = adoptRefCountedGarbageCollectedWillBeNoop(new DOMWebSocketWithMockChannel(context)); + DOMWebSocketWithMockChannel* websocket = new DOMWebSocketWithMockChannel(context); websocket->suspendIfNeeded(); return websocket; } MockWebSocketChannel* channel() { return m_channel.get(); } - virtual WebSocketChannel* createChannel(ExecutionContext*, WebSocketChannelClient*) OVERRIDE + virtual WebSocketChannel* createChannel(ExecutionContext*, WebSocketChannelClient*) override { ASSERT(!m_hasCreatedChannel); m_hasCreatedChannel = true; return m_channel.get(); } - virtual void trace(Visitor* visitor) OVERRIDE + virtual void trace(Visitor* visitor) override { visitor->trace(m_channel); DOMWebSocket::trace(visitor); @@ -112,14 +110,12 @@ public: if (!m_websocket) return; // These statements are needed to clear WebSocket::m_channel to - // avoid ASSERTION failure on ~WebSocket. + // avoid ASSERTION failure on ~DOMWebSocket. ASSERT(m_websocket->channel()); ::testing::Mock::VerifyAndClear(m_websocket->channel()); EXPECT_CALL(channel(), disconnect()).Times(AnyNumber()); m_websocket->didClose(WebSocketChannelClient::ClosingHandshakeIncomplete, 1006, ""); - m_websocket.clear(); - Heap::collectAllGarbage(); } MockWebSocketChannel& channel() { return *m_websocket->channel(); } @@ -185,11 +181,6 @@ TEST_F(DOMWebSocketTest, invalidSubprotocols) Vector subprotocols; subprotocols.append("@subprotocol-|'\"x\x01\x02\x03x"); - { - InSequence s; - EXPECT_CALL(channel(), disconnect()); - } - m_websocket->connect("ws://example.com/", subprotocols, m_exceptionState); EXPECT_TRUE(m_exceptionState.hadException()); @@ -553,7 +544,7 @@ TEST_F(DOMWebSocketTest, sendStringSuccess) TEST_F(DOMWebSocketTest, sendArrayBufferWhenConnecting) { - RefPtr view = Uint8Array::create(8); + RefPtr view = DOMUint8Array::create(8); { InSequence s; EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true)); @@ -572,7 +563,7 @@ TEST_F(DOMWebSocketTest, sendArrayBufferWhenConnecting) TEST_F(DOMWebSocketTest, sendArrayBufferWhenClosing) { - RefPtr view = Uint8Array::create(8); + RefPtr view = DOMUint8Array::create(8); { InSequence s; EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true)); @@ -594,7 +585,7 @@ TEST_F(DOMWebSocketTest, sendArrayBufferWhenClosing) TEST_F(DOMWebSocketTest, sendArrayBufferWhenClosed) { Checkpoint checkpoint; - RefPtr view = Uint8Array::create(8); + RefPtr view = DOMUint8Array::create(8); { InSequence s; EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true)); @@ -616,11 +607,11 @@ TEST_F(DOMWebSocketTest, sendArrayBufferWhenClosed) TEST_F(DOMWebSocketTest, sendArrayBufferSuccess) { - RefPtr view = Uint8Array::create(8); + RefPtr view = DOMUint8Array::create(8); { InSequence s; EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true)); - EXPECT_CALL(channel(), send(Ref(*view->buffer()), 0, 8)); + EXPECT_CALL(channel(), send(Ref(*view->view()->buffer()), 0, 8)); } m_websocket->connect("ws://example.com/", Vector(), m_exceptionState);