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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Close the client before the listener to avoid TIME_WAIT issues. | 117 // Close the client before the listener to avoid TIME_WAIT issues. |
118 client->Shutdown(); | 118 client->Shutdown(); |
119 delete client; | 119 delete client; |
120 delete listener; | 120 delete listener; |
121 } | 121 } |
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 + FlagDependentPortOffset(); |
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"; |
(...skipping 19 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 |