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

Unified Diff: ppapi/tests/test_tcp_socket_private.cc

Issue 22923014: TCPSockets are switched to the new Pepper proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 7 years, 4 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
« no previous file with comments | « ppapi/tests/test_tcp_socket_private.h ('k') | ppapi/thunk/interfaces_ppb_private_no_permissions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_tcp_socket_private.cc
diff --git a/ppapi/tests/test_tcp_socket_private.cc b/ppapi/tests/test_tcp_socket_private.cc
index ba1c8f1ebddac632d16699951dcae63f10cbab0f..d3efbe335d514ec1c3b105a9a892060b295f2d5f 100644
--- a/ppapi/tests/test_tcp_socket_private.cc
+++ b/ppapi/tests/test_tcp_socket_private.cc
@@ -6,9 +6,11 @@
#include <stdlib.h>
+#include <new>
+
#include "ppapi/cpp/private/tcp_socket_private.h"
-#include "ppapi/tests/testing_instance.h"
#include "ppapi/tests/test_utils.h"
+#include "ppapi/tests/testing_instance.h"
namespace {
@@ -52,6 +54,7 @@ void TestTCPSocketPrivate::RunTests(const std::string& filter) {
RUN_CALLBACK_TEST(TestTCPSocketPrivate, ReadWriteSSL, filter);
RUN_CALLBACK_TEST(TestTCPSocketPrivate, ConnectAddress, filter);
RUN_CALLBACK_TEST(TestTCPSocketPrivate, SetOption, filter);
+ RUN_CALLBACK_TEST(TestTCPSocketPrivate, LargeRead, filter);
}
std::string TestTCPSocketPrivate::TestBasic() {
@@ -181,6 +184,35 @@ std::string TestTCPSocketPrivate::TestSetOption() {
PASS();
}
+std::string TestTCPSocketPrivate::TestLargeRead() {
+ pp::TCPSocketPrivate socket(instance_);
+ {
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
+
+ cb.WaitForResult(socket.Connect(host_.c_str(), port_, cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_EQ(PP_OK, cb.result());
+ }
+
+ ASSERT_EQ(PP_OK, WriteStringToSocket(&socket, "GET / HTTP/1.0\r\n\r\n"));
+
+ const size_t kReadSize = 1024 * 1024 + 32;
+ // Create large buffer in heap to prevent run-time errors related to
+ // limits on stack size.
+ char* buffer = new (std::nothrow) char[kReadSize];
+ ASSERT_TRUE(buffer != NULL);
+
+ TestCompletionCallback cb(instance_->pp_instance(), callback_type());
+ cb.WaitForResult(socket.Read(buffer, kReadSize * sizeof(*buffer),
+ cb.GetCallback()));
+ CHECK_CALLBACK_BEHAVIOR(cb);
+ ASSERT_LE(0, cb.result());
+
+ delete [] buffer;
+
+ PASS();
+}
+
int32_t TestTCPSocketPrivate::ReadFirstLineFromSocket(
pp::TCPSocketPrivate* socket,
std::string* s) {
« no previous file with comments | « ppapi/tests/test_tcp_socket_private.h ('k') | ppapi/thunk/interfaces_ppb_private_no_permissions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698