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

Unified Diff: net/http/http_network_transaction_unittest.cc

Issue 39203004: [Net] Fix error handling on wrong file in UploadData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
Index: net/http/http_network_transaction_unittest.cc
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index aee02b28b0789bab9853a6a017c4cb03103155b5..60d7182b3cd947845175222550bacf5edaa01be4 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -7724,8 +7724,7 @@ TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) {
request.upload_data_stream = &upload_data_stream;
request.load_flags = 0;
- // If we try to upload an unreadable file, the network stack should report
- // the file size as zero and upload zero bytes for that file.
+ // If we try to upload an unreadable file, the transaction should fail.
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session));
@@ -7751,12 +7750,10 @@ TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) {
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
- EXPECT_EQ(OK, rv);
+ EXPECT_EQ(ERR_ACCESS_DENIED, rv);
const HttpResponseInfo* response = trans->GetResponseInfo();
- ASSERT_TRUE(response != NULL);
- EXPECT_TRUE(response->headers.get() != NULL);
- EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine());
+ EXPECT_FALSE(response);
base::DeleteFile(temp_file, false);
}
@@ -7841,13 +7838,10 @@ TEST_P(HttpNetworkTransactionTest, UnreadableUploadFileAfterAuthRestart) {
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback2.WaitForResult();
- EXPECT_EQ(OK, rv);
+ EXPECT_EQ(ERR_ACCESS_DENIED, rv);
response = trans->GetResponseInfo();
- ASSERT_TRUE(response != NULL);
- EXPECT_TRUE(response->headers.get() != NULL);
- EXPECT_TRUE(response->auth_challenge.get() == NULL);
- EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
+ EXPECT_FALSE(response);
base::DeleteFile(temp_file, false);
}

Powered by Google App Engine
This is Rietveld 408576698