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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 2150913002: Update URLRequestTestHTTP.GetZippedTest test assertions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 38289f78757f6dd57a1a7d1f9779736f0622b5bc..a657c8eadf6600b0c4bc3af651ef1e2dde5edd48 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -4630,7 +4630,14 @@ TEST_F(URLRequestTestHTTP, GetZippedTest) {
const bool test_expect_success[num_tests] =
{ true, true, false, false, true };
- for (int i = 0; i < num_tests ; i++) {
+ base::FilePath file_path;
+ PathService::Get(base::DIR_SOURCE_ROOT, &file_path);
+ file_path = file_path.Append(kTestFilePath);
+ file_path = file_path.Append(FILE_PATH_LITERAL("BullRunSpeech.txt"));
+ std::string expected_content;
+ ASSERT_TRUE(base::ReadFileToString(file_path, &expected_content));
+
+ for (int i = 0; i < num_tests; i++) {
TestDelegate d;
{
std::string test_file = base::StringPrintf(
@@ -4656,6 +4663,13 @@ TEST_F(URLRequestTestHTTP, GetZippedTest) {
if (test_expect_success[i]) {
EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status())
<< " Parameter = \"" << test_file << "\"";
+ if (test_parameters[i] == 'S') {
+ // When content length is smaller than both compressed length and
+ // uncompressed length, HttpStreamParser might not read the full
+ // response body.
+ continue;
+ }
+ EXPECT_EQ(expected_content, d.data_received());
} else {
EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, r->status().error())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698