OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/websockets/WebSocketChannel.h" | 6 #include "modules/websockets/WebSocketChannel.h" |
7 | 7 |
8 #include "core/dom/DOMArrayBuffer.h" | 8 #include "core/dom/DOMArrayBuffer.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/fileapi/Blob.h" | 10 #include "core/fileapi/Blob.h" |
11 #include "core/frame/ConsoleTypes.h" | 11 #include "core/frame/ConsoleTypes.h" |
12 #include "core/testing/DummyPageHolder.h" | 12 #include "core/testing/DummyPageHolder.h" |
13 #include "modules/websockets/DocumentWebSocketChannel.h" | 13 #include "modules/websockets/DocumentWebSocketChannel.h" |
14 #include "modules/websockets/WebSocketChannelClient.h" | 14 #include "modules/websockets/WebSocketChannelClient.h" |
15 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
16 #include "platform/weborigin/KURL.h" | 16 #include "platform/weborigin/KURL.h" |
17 #include "public/platform/WebSecurityOrigin.h" | 17 #include "public/platform/WebSecurityOrigin.h" |
18 #include "public/platform/WebSerializedOrigin.h" | |
19 #include "public/platform/WebSocketHandle.h" | 18 #include "public/platform/WebSocketHandle.h" |
20 #include "public/platform/WebSocketHandleClient.h" | 19 #include "public/platform/WebSocketHandleClient.h" |
21 #include "public/platform/WebString.h" | 20 #include "public/platform/WebString.h" |
22 #include "public/platform/WebURL.h" | 21 #include "public/platform/WebURL.h" |
23 #include "public/platform/WebVector.h" | 22 #include "public/platform/WebVector.h" |
24 #include "wtf/OwnPtr.h" | 23 #include "wtf/OwnPtr.h" |
25 #include "wtf/Vector.h" | 24 #include "wtf/Vector.h" |
26 #include "wtf/text/WTFString.h" | 25 #include "wtf/text/WTFString.h" |
27 #include <stdint.h> | 26 #include <stdint.h> |
28 | 27 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 public: | 75 public: |
77 static MockWebSocketHandle* create() | 76 static MockWebSocketHandle* create() |
78 { | 77 { |
79 return new testing::StrictMock<MockWebSocketHandle>(); | 78 return new testing::StrictMock<MockWebSocketHandle>(); |
80 } | 79 } |
81 | 80 |
82 MockWebSocketHandle() { } | 81 MockWebSocketHandle() { } |
83 | 82 |
84 ~MockWebSocketHandle() override { } | 83 ~MockWebSocketHandle() override { } |
85 | 84 |
86 MOCK_METHOD4(connect, void(const WebURL&, const WebVector<WebString>&, const
WebSerializedOrigin&, WebSocketHandleClient*)); | 85 MOCK_METHOD4(connect, void(const WebURL&, const WebVector<WebString>&, const
WebSecurityOrigin&, WebSocketHandleClient*)); |
87 MOCK_METHOD4(send, void(bool, WebSocketHandle::MessageType, const char*, siz
e_t)); | 86 MOCK_METHOD4(send, void(bool, WebSocketHandle::MessageType, const char*, siz
e_t)); |
88 MOCK_METHOD1(flowControl, void(int64_t)); | 87 MOCK_METHOD1(flowControl, void(int64_t)); |
89 MOCK_METHOD2(close, void(unsigned short, const WebString&)); | 88 MOCK_METHOD2(close, void(unsigned short, const WebString&)); |
90 }; | 89 }; |
91 | 90 |
92 class DocumentWebSocketChannelTest : public ::testing::Test { | 91 class DocumentWebSocketChannelTest : public ::testing::Test { |
93 public: | 92 public: |
94 DocumentWebSocketChannelTest() | 93 DocumentWebSocketChannelTest() |
95 : m_pageHolder(DummyPageHolder::create()) | 94 : m_pageHolder(DummyPageHolder::create()) |
96 , m_channelClient(MockWebSocketChannelClient::create()) | 95 , m_channelClient(MockWebSocketChannelClient::create()) |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 EXPECT_CALL(*channelClient(), didError()); | 681 EXPECT_CALL(*channelClient(), didError()); |
683 EXPECT_CALL(*channelClient(), didClose(WebSocketChannelClient::ClosingHa
ndshakeIncomplete, WebSocketChannel::CloseEventCodeAbnormalClosure, String())); | 682 EXPECT_CALL(*channelClient(), didClose(WebSocketChannelClient::ClosingHa
ndshakeIncomplete, WebSocketChannel::CloseEventCodeAbnormalClosure, String())); |
684 } | 683 } |
685 | 684 |
686 channel()->fail("fail message from WebSocket", ErrorMessageLevel, "sourceURL
", 1234); | 685 channel()->fail("fail message from WebSocket", ErrorMessageLevel, "sourceURL
", 1234); |
687 } | 686 } |
688 | 687 |
689 } // namespace | 688 } // namespace |
690 | 689 |
691 } // namespace blink | 690 } // namespace blink |
OLD | NEW |