OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 | 2 |
3 #include "v8.h" | 3 #include "v8.h" |
4 #include "platform.h" | 4 #include "platform.h" |
5 #include "cctest.h" | 5 #include "cctest.h" |
6 | 6 |
7 | 7 |
8 using namespace ::v8::internal; | 8 using namespace ::v8::internal; |
9 | 9 |
10 | 10 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 | 123 |
124 TEST(Socket) { | 124 TEST(Socket) { |
125 // Make sure this port is not used by other tests to allow tests to run in | 125 // Make sure this port is not used by other tests to allow tests to run in |
126 // parallel. | 126 // parallel. |
127 static const int kPort = 5859; | 127 static const int kPort = 5859; |
128 | 128 |
129 bool ok; | 129 bool ok; |
130 | 130 |
131 // Initialize socket support. | 131 // Initialize socket support. |
132 ok = Socket::Setup(); | 132 ok = Socket::SetUp(); |
133 CHECK(ok); | 133 CHECK(ok); |
134 | 134 |
135 // Send and receive some data. | 135 // Send and receive some data. |
136 static const int kBufferSizeSmall = 20; | 136 static const int kBufferSizeSmall = 20; |
137 char small_data[kBufferSizeSmall + 1] = "1234567890abcdefghij"; | 137 char small_data[kBufferSizeSmall + 1] = "1234567890abcdefghij"; |
138 SendAndReceive(kPort, small_data, kBufferSizeSmall); | 138 SendAndReceive(kPort, small_data, kBufferSizeSmall); |
139 | 139 |
140 // Send and receive some more data. | 140 // Send and receive some more data. |
141 static const int kBufferSizeMedium = 10000; | 141 static const int kBufferSizeMedium = 10000; |
142 char* medium_data = new char[kBufferSizeMedium]; | 142 char* medium_data = new char[kBufferSizeMedium]; |
(...skipping 14 matching lines...) Expand all Loading... |
157 } | 157 } |
158 | 158 |
159 | 159 |
160 TEST(HToNNToH) { | 160 TEST(HToNNToH) { |
161 uint16_t x = 1234; | 161 uint16_t x = 1234; |
162 CHECK_EQ(x, Socket::NToH(Socket::HToN(x))); | 162 CHECK_EQ(x, Socket::NToH(Socket::HToN(x))); |
163 | 163 |
164 uint32_t y = 12345678; | 164 uint32_t y = 12345678; |
165 CHECK(y == Socket::NToH(Socket::HToN(y))); | 165 CHECK(y == Socket::NToH(Socket::HToN(y))); |
166 } | 166 } |
OLD | NEW |