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

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

Issue 2143483002: Use the single char overload of append() when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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/DOMWebSocketTest.cpp
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
index 7669a9cf18ed0d7eea57564115307136490b9213..53b7bc60f3017ad82d00d59b095af4860d0c9f8e 100644
--- a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
@@ -20,6 +20,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "wtf/Vector.h"
#include "wtf/text/CString.h"
+#include "wtf/text/StringBuilder.h"
#include "wtf/text/WTFString.h"
#include <memory>
#include <v8.h>
@@ -358,15 +359,15 @@ TEST(DOMWebSocketTest, maximumReasonSize)
EXPECT_CALL(webSocketScope.channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true));
EXPECT_CALL(webSocketScope.channel(), failMock(_, _, _));
}
- String reason;
+ StringBuilder reason;
for (size_t i = 0; i < 123; ++i)
- reason.append("a");
+ reason.append('a');
webSocketScope.socket().connect("ws://example.com/", Vector<String>(), scope.getExceptionState());
EXPECT_FALSE(scope.getExceptionState().hadException());
EXPECT_EQ(DOMWebSocket::CONNECTING, webSocketScope.socket().readyState());
- webSocketScope.socket().close(1000, reason, scope.getExceptionState());
+ webSocketScope.socket().close(1000, reason.toString(), scope.getExceptionState());
EXPECT_FALSE(scope.getExceptionState().hadException());
EXPECT_EQ(DOMWebSocket::CLOSING, webSocketScope.socket().readyState());
@@ -380,15 +381,15 @@ TEST(DOMWebSocketTest, reasonSizeExceeding)
InSequence s;
EXPECT_CALL(webSocketScope.channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true));
}
- String reason;
+ StringBuilder reason;
for (size_t i = 0; i < 124; ++i)
- reason.append("a");
+ reason.append('a');
webSocketScope.socket().connect("ws://example.com/", Vector<String>(), scope.getExceptionState());
EXPECT_FALSE(scope.getExceptionState().hadException());
EXPECT_EQ(DOMWebSocket::CONNECTING, webSocketScope.socket().readyState());
- webSocketScope.socket().close(1000, reason, scope.getExceptionState());
+ webSocketScope.socket().close(1000, reason.toString(), scope.getExceptionState());
EXPECT_TRUE(scope.getExceptionState().hadException());
EXPECT_EQ(SyntaxError, scope.getExceptionState().code());

Powered by Google App Engine
This is Rietveld 408576698