| Index: third_party/WebKit/Source/modules/peerconnection/RTCDataChannelTest.cpp
|
| diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCDataChannelTest.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCDataChannelTest.cpp
|
| index bdeadde914ad61cd7a9f23a38a2562035dd2190e..fdbd3971b1bd7338540e6e3e1f0a50ec353b6609 100644
|
| --- a/third_party/WebKit/Source/modules/peerconnection/RTCDataChannelTest.cpp
|
| +++ b/third_party/WebKit/Source/modules/peerconnection/RTCDataChannelTest.cpp
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "modules/peerconnection/RTCDataChannel.h"
|
|
|
| +#include <string>
|
| #include "bindings/core/v8/ExceptionState.h"
|
| #include "core/dom/DOMArrayBuffer.h"
|
| #include "core/dom/DOMException.h"
|
| @@ -146,4 +147,26 @@ TEST(RTCDataChannelTest, BufferedAmountLow) {
|
| std::string(channel->scheduled_events_.back()->type().Utf8().data()));
|
| }
|
|
|
| +TEST(RTCDataChannelTest, SendAfterContextDestroyed) {
|
| + MockHandler* handler = new MockHandler();
|
| + RTCDataChannel* channel = RTCDataChannel::Create(0, WTF::WrapUnique(handler));
|
| + handler->ChangeState(WebRTCDataChannelHandlerClient::kReadyStateOpen);
|
| + channel->ContextDestroyed(nullptr);
|
| +
|
| + String message(std::string(100, 'A').c_str());
|
| + DummyExceptionStateForTesting exception_state;
|
| + channel->send(message, exception_state);
|
| +
|
| + EXPECT_TRUE(exception_state.HadException());
|
| +}
|
| +
|
| +TEST(RTCDataChannelTest, CloseAfterContextDestroyed) {
|
| + MockHandler* handler = new MockHandler();
|
| + RTCDataChannel* channel = RTCDataChannel::Create(0, WTF::WrapUnique(handler));
|
| + handler->ChangeState(WebRTCDataChannelHandlerClient::kReadyStateOpen);
|
| + channel->ContextDestroyed(nullptr);
|
| + channel->close();
|
| + EXPECT_EQ(String::FromUTF8("closed"), channel->readyState());
|
| +}
|
| +
|
| } // namespace blink
|
|
|