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

Unified Diff: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 years, 1 month 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: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
index 94afbcc2e35908c6b118f1b007e83b57ae6a2184..b854c624769efa310ac6171753a8574be30310fd 100644
--- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
@@ -350,7 +350,7 @@ TEST_F(DocumentWebSocketChannelTest, sendBinaryInArrayBuffer)
handleClient()->didReceiveFlowControl(handle(), 16);
EXPECT_CALL(*channelClient(), didConsumeBufferedAmount(_)).Times(AnyNumber());
- RefPtr<DOMArrayBuffer> fooBuffer = DOMArrayBuffer::create("foo", 3);
+ RefPtr<DOMArrayBuffer> fooBuffer = DOMArrayBuffer::deprecatedCreateOrCrash("foo", 3);
channel()->send(*fooBuffer, 0, 3);
EXPECT_EQ(3ul, m_sumOfConsumedBufferedAmount);
@@ -370,8 +370,8 @@ TEST_F(DocumentWebSocketChannelTest, sendBinaryInArrayBufferPartial)
handleClient()->didReceiveFlowControl(handle(), 16);
EXPECT_CALL(*channelClient(), didConsumeBufferedAmount(_)).Times(AnyNumber());
- RefPtr<DOMArrayBuffer> foobarBuffer = DOMArrayBuffer::create("foobar", 6);
- RefPtr<DOMArrayBuffer> qbazuxBuffer = DOMArrayBuffer::create("qbazux", 6);
+ RefPtr<DOMArrayBuffer> foobarBuffer = DOMArrayBuffer::deprecatedCreateOrCrash("foobar", 6);
+ RefPtr<DOMArrayBuffer> qbazuxBuffer = DOMArrayBuffer::deprecatedCreateOrCrash("qbazux", 6);
channel()->send(*foobarBuffer, 0, 3);
channel()->send(*foobarBuffer, 3, 3);
channel()->send(*qbazuxBuffer, 1, 3);
@@ -395,19 +395,19 @@ TEST_F(DocumentWebSocketChannelTest, sendBinaryInArrayBufferWithNullBytes)
EXPECT_CALL(*channelClient(), didConsumeBufferedAmount(_)).Times(AnyNumber());
{
- RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::create("\0ar", 3);
+ RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::deprecatedCreateOrCrash("\0ar", 3);
channel()->send(*b, 0, 3);
}
{
- RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::create("b\0z", 3);
+ RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::deprecatedCreateOrCrash("b\0z", 3);
channel()->send(*b, 0, 3);
}
{
- RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::create("qu\0", 3);
+ RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::deprecatedCreateOrCrash("qu\0", 3);
channel()->send(*b, 0, 3);
}
{
- RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::create("\0\0\0", 3);
+ RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::deprecatedCreateOrCrash("\0\0\0", 3);
channel()->send(*b, 0, 3);
}
@@ -422,7 +422,7 @@ TEST_F(DocumentWebSocketChannelTest, sendBinaryInArrayBufferNonLatin1UTF8)
handleClient()->didReceiveFlowControl(handle(), 16);
EXPECT_CALL(*channelClient(), didConsumeBufferedAmount(_)).Times(AnyNumber());
- RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::create("\xe7\x8b\x90", 3);
+ RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::deprecatedCreateOrCrash("\xe7\x8b\x90", 3);
channel()->send(*b, 0, 3);
EXPECT_EQ(3ul, m_sumOfConsumedBufferedAmount);
@@ -436,7 +436,7 @@ TEST_F(DocumentWebSocketChannelTest, sendBinaryInArrayBufferNonUTF8)
handleClient()->didReceiveFlowControl(handle(), 16);
EXPECT_CALL(*channelClient(), didConsumeBufferedAmount(_)).Times(AnyNumber());
- RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::create("\x80\xff\xe7", 3);
+ RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::deprecatedCreateOrCrash("\x80\xff\xe7", 3);
channel()->send(*b, 0, 3);
EXPECT_EQ(3ul, m_sumOfConsumedBufferedAmount);
@@ -456,7 +456,7 @@ TEST_F(DocumentWebSocketChannelTest, sendBinaryInArrayBufferNonLatin1UTF8Continu
handleClient()->didReceiveFlowControl(handle(), 16);
EXPECT_CALL(*channelClient(), didConsumeBufferedAmount(_)).Times(AnyNumber());
- RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::create("\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90", 18);
+ RefPtr<DOMArrayBuffer> b = DOMArrayBuffer::deprecatedCreateOrCrash("\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90", 18);
channel()->send(*b, 0, 18);
checkpoint.Call(1);

Powered by Google App Engine
This is Rietveld 408576698