| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #elif defined(USE_NSS) | 10 #elif defined(USE_NSS) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 EXPECT_FALSE(d.received_data_before_response()); | 172 EXPECT_FALSE(d.received_data_before_response()); |
| 173 EXPECT_EQ(uploadBytes, d.data_received()); | 173 EXPECT_EQ(uploadBytes, d.data_received()); |
| 174 EXPECT_EQ(memcmp(uploadBytes, d.data_received().c_str(), kMsgSize), 0); | 174 EXPECT_EQ(memcmp(uploadBytes, d.data_received().c_str(), kMsgSize), 0); |
| 175 EXPECT_EQ(d.data_received().compare(uploadBytes), 0); | 175 EXPECT_EQ(d.data_received().compare(uploadBytes), 0); |
| 176 } | 176 } |
| 177 delete[] uploadBytes; | 177 delete[] uploadBytes; |
| 178 } | 178 } |
| 179 | 179 |
| 180 void AddChunksToUpload(TestURLRequest* r) { | 180 void AddChunksToUpload(TestURLRequest* r) { |
| 181 r->AppendChunkToUpload("a", 1); | 181 r->AppendChunkToUpload("a", 1, false); |
| 182 r->AppendChunkToUpload("bcd", 3); | 182 r->AppendChunkToUpload("bcd", 3, false); |
| 183 r->AppendChunkToUpload("this is a longer chunk than before.", 35); | 183 r->AppendChunkToUpload("this is a longer chunk than before.", 35, false); |
| 184 r->AppendChunkToUpload("\r\n\r\n", 4); | 184 r->AppendChunkToUpload("\r\n\r\n", 4, false); |
| 185 r->AppendChunkToUpload("0", 1); | 185 r->AppendChunkToUpload("0", 1, false); |
| 186 r->AppendChunkToUpload("2323", 4); | 186 r->AppendChunkToUpload("2323", 4, true); |
| 187 r->MarkEndOfChunks(); | |
| 188 } | 187 } |
| 189 | 188 |
| 190 void VerifyReceivedDataMatchesChunks(TestURLRequest* r, TestDelegate* d) { | 189 void VerifyReceivedDataMatchesChunks(TestURLRequest* r, TestDelegate* d) { |
| 191 // This should match the chunks sent by AddChunksToUpload(). | 190 // This should match the chunks sent by AddChunksToUpload(). |
| 192 const char* expected_data = | 191 const char* expected_data = |
| 193 "abcdthis is a longer chunk than before.\r\n\r\n02323"; | 192 "abcdthis is a longer chunk than before.\r\n\r\n02323"; |
| 194 | 193 |
| 195 ASSERT_EQ(1, d->response_started_count()) << "request failed: " << | 194 ASSERT_EQ(1, d->response_started_count()) << "request failed: " << |
| 196 (int) r->status().status() << ", os error: " << r->status().os_error(); | 195 (int) r->status().status() << ", os error: " << r->status().os_error(); |
| 197 | 196 |
| (...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2828 net::HttpRequestHeaders headers; | 2827 net::HttpRequestHeaders headers; |
| 2829 headers.SetHeader(net::HttpRequestHeaders::kUserAgent, "Lynx (textmode)"); | 2828 headers.SetHeader(net::HttpRequestHeaders::kUserAgent, "Lynx (textmode)"); |
| 2830 req.SetExtraRequestHeaders(headers); | 2829 req.SetExtraRequestHeaders(headers); |
| 2831 req.Start(); | 2830 req.Start(); |
| 2832 MessageLoop::current()->Run(); | 2831 MessageLoop::current()->Run(); |
| 2833 // If the net tests are being run with ChromeFrame then we need to allow for | 2832 // If the net tests are being run with ChromeFrame then we need to allow for |
| 2834 // the 'chromeframe' suffix which is added to the user agent before the | 2833 // the 'chromeframe' suffix which is added to the user agent before the |
| 2835 // closing parentheses. | 2834 // closing parentheses. |
| 2836 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); | 2835 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); |
| 2837 } | 2836 } |
| OLD | NEW |