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 "modules/websockets/WebSocketChannel.h" | 5 #include "modules/websockets/WebSocketChannel.h" |
6 | 6 |
7 #include "core/dom/DOMArrayBuffer.h" | 7 #include "core/dom/DOMArrayBuffer.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/fileapi/Blob.h" | 9 #include "core/fileapi/Blob.h" |
10 #include "core/testing/DummyPageHolder.h" | 10 #include "core/testing/DummyPageHolder.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 MOCK_METHOD1(flowControl, void(int64_t)); | 85 MOCK_METHOD1(flowControl, void(int64_t)); |
86 MOCK_METHOD2(close, void(unsigned short, const WebString&)); | 86 MOCK_METHOD2(close, void(unsigned short, const WebString&)); |
87 }; | 87 }; |
88 | 88 |
89 class DocumentWebSocketChannelTest : public ::testing::Test { | 89 class DocumentWebSocketChannelTest : public ::testing::Test { |
90 public: | 90 public: |
91 DocumentWebSocketChannelTest() | 91 DocumentWebSocketChannelTest() |
92 : m_pageHolder(DummyPageHolder::create()) | 92 : m_pageHolder(DummyPageHolder::create()) |
93 , m_channelClient(MockWebSocketChannelClient::create()) | 93 , m_channelClient(MockWebSocketChannelClient::create()) |
94 , m_handle(MockWebSocketHandle::create()) | 94 , m_handle(MockWebSocketHandle::create()) |
95 , m_channel(DocumentWebSocketChannel::create(&m_pageHolder->document(),
m_channelClient.get(), String(), 0, handle())) | 95 , m_channel(DocumentWebSocketChannel::create(&m_pageHolder->document(),
m_channelClient.get(), SourceLocation::capture(), handle())) |
96 , m_sumOfConsumedBufferedAmount(0) | 96 , m_sumOfConsumedBufferedAmount(0) |
97 { | 97 { |
98 ON_CALL(*channelClient(), didConsumeBufferedAmount(_)).WillByDefault(Inv
oke(this, &DocumentWebSocketChannelTest::didConsumeBufferedAmount)); | 98 ON_CALL(*channelClient(), didConsumeBufferedAmount(_)).WillByDefault(Inv
oke(this, &DocumentWebSocketChannelTest::didConsumeBufferedAmount)); |
99 } | 99 } |
100 | 100 |
101 ~DocumentWebSocketChannelTest() | 101 ~DocumentWebSocketChannelTest() |
102 { | 102 { |
103 channel()->disconnect(); | 103 channel()->disconnect(); |
104 } | 104 } |
105 | 105 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 TEST_F(DocumentWebSocketChannelTest, failFromWebSocket) | 673 TEST_F(DocumentWebSocketChannelTest, failFromWebSocket) |
674 { | 674 { |
675 connect(); | 675 connect(); |
676 { | 676 { |
677 InSequence s; | 677 InSequence s; |
678 | 678 |
679 EXPECT_CALL(*channelClient(), didError()); | 679 EXPECT_CALL(*channelClient(), didError()); |
680 EXPECT_CALL(*channelClient(), didClose(WebSocketChannelClient::ClosingHa
ndshakeIncomplete, WebSocketChannel::CloseEventCodeAbnormalClosure, String())); | 680 EXPECT_CALL(*channelClient(), didClose(WebSocketChannelClient::ClosingHa
ndshakeIncomplete, WebSocketChannel::CloseEventCodeAbnormalClosure, String())); |
681 } | 681 } |
682 | 682 |
683 channel()->fail("fail message from WebSocket", ErrorMessageLevel, "sourceURL
", 1234); | 683 channel()->fail("fail message from WebSocket", ErrorMessageLevel, nullptr); |
684 } | 684 } |
685 | 685 |
686 } // namespace | 686 } // namespace |
687 | 687 |
688 } // namespace blink | 688 } // namespace blink |
OLD | NEW |