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

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_cache.cc ('k') | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "net/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <math.h> // ceil 7 #include <math.h> // ceil
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 7593 matching lines...) Expand 10 before | Expand all | Expand 10 after
7604 ASSERT_TRUE(response != NULL); 7604 ASSERT_TRUE(response != NULL);
7605 7605
7606 EXPECT_TRUE(response->headers.get() != NULL); 7606 EXPECT_TRUE(response->headers.get() != NULL);
7607 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); 7607 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine());
7608 7608
7609 std::string response_data; 7609 std::string response_data;
7610 rv = ReadTransaction(trans.get(), &response_data); 7610 rv = ReadTransaction(trans.get(), &response_data);
7611 EXPECT_EQ(OK, rv); 7611 EXPECT_EQ(OK, rv);
7612 EXPECT_EQ("hello world", response_data); 7612 EXPECT_EQ("hello world", response_data);
7613 7613
7614 file_util::Delete(temp_file_path, false); 7614 base::Delete(temp_file_path, false);
7615 } 7615 }
7616 7616
7617 TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) { 7617 TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) {
7618 base::FilePath temp_file; 7618 base::FilePath temp_file;
7619 ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file)); 7619 ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file));
7620 std::string temp_file_content("Unreadable file."); 7620 std::string temp_file_content("Unreadable file.");
7621 ASSERT_TRUE(file_util::WriteFile(temp_file, temp_file_content.c_str(), 7621 ASSERT_TRUE(file_util::WriteFile(temp_file, temp_file_content.c_str(),
7622 temp_file_content.length())); 7622 temp_file_content.length()));
7623 ASSERT_TRUE(file_util::MakeFileUnreadable(temp_file)); 7623 ASSERT_TRUE(file_util::MakeFileUnreadable(temp_file));
7624 7624
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
7664 EXPECT_EQ(ERR_IO_PENDING, rv); 7664 EXPECT_EQ(ERR_IO_PENDING, rv);
7665 7665
7666 rv = callback.WaitForResult(); 7666 rv = callback.WaitForResult();
7667 EXPECT_EQ(OK, rv); 7667 EXPECT_EQ(OK, rv);
7668 7668
7669 const HttpResponseInfo* response = trans->GetResponseInfo(); 7669 const HttpResponseInfo* response = trans->GetResponseInfo();
7670 ASSERT_TRUE(response != NULL); 7670 ASSERT_TRUE(response != NULL);
7671 EXPECT_TRUE(response->headers.get() != NULL); 7671 EXPECT_TRUE(response->headers.get() != NULL);
7672 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); 7672 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine());
7673 7673
7674 file_util::Delete(temp_file, false); 7674 base::Delete(temp_file, false);
7675 } 7675 }
7676 7676
7677 TEST_P(HttpNetworkTransactionTest, UnreadableUploadFileAfterAuthRestart) { 7677 TEST_P(HttpNetworkTransactionTest, UnreadableUploadFileAfterAuthRestart) {
7678 base::FilePath temp_file; 7678 base::FilePath temp_file;
7679 ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file)); 7679 ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file));
7680 std::string temp_file_contents("Unreadable file."); 7680 std::string temp_file_contents("Unreadable file.");
7681 std::string unreadable_contents(temp_file_contents.length(), '\0'); 7681 std::string unreadable_contents(temp_file_contents.length(), '\0');
7682 ASSERT_TRUE(file_util::WriteFile(temp_file, temp_file_contents.c_str(), 7682 ASSERT_TRUE(file_util::WriteFile(temp_file, temp_file_contents.c_str(),
7683 temp_file_contents.length())); 7683 temp_file_contents.length()));
7684 7684
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
7755 7755
7756 rv = callback2.WaitForResult(); 7756 rv = callback2.WaitForResult();
7757 EXPECT_EQ(OK, rv); 7757 EXPECT_EQ(OK, rv);
7758 7758
7759 response = trans->GetResponseInfo(); 7759 response = trans->GetResponseInfo();
7760 ASSERT_TRUE(response != NULL); 7760 ASSERT_TRUE(response != NULL);
7761 EXPECT_TRUE(response->headers.get() != NULL); 7761 EXPECT_TRUE(response->headers.get() != NULL);
7762 EXPECT_TRUE(response->auth_challenge.get() == NULL); 7762 EXPECT_TRUE(response->auth_challenge.get() == NULL);
7763 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); 7763 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
7764 7764
7765 file_util::Delete(temp_file, false); 7765 base::Delete(temp_file, false);
7766 } 7766 }
7767 7767
7768 // Tests that changes to Auth realms are treated like auth rejections. 7768 // Tests that changes to Auth realms are treated like auth rejections.
7769 TEST_P(HttpNetworkTransactionTest, ChangeAuthRealms) { 7769 TEST_P(HttpNetworkTransactionTest, ChangeAuthRealms) {
7770 7770
7771 HttpRequestInfo request; 7771 HttpRequestInfo request;
7772 request.method = "GET"; 7772 request.method = "GET";
7773 request.url = GURL("http://www.google.com/"); 7773 request.url = GURL("http://www.google.com/");
7774 request.load_flags = 0; 7774 request.load_flags = 0;
7775 7775
(...skipping 3942 matching lines...) Expand 10 before | Expand all | Expand 10 after
11718 EXPECT_EQ(OK, rv); 11718 EXPECT_EQ(OK, rv);
11719 11719
11720 HttpRequestHeaders request_headers; 11720 HttpRequestHeaders request_headers;
11721 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); 11721 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers));
11722 std::string foo; 11722 std::string foo;
11723 EXPECT_TRUE(request_headers.GetHeader("X-Foo", &foo)); 11723 EXPECT_TRUE(request_headers.GetHeader("X-Foo", &foo));
11724 EXPECT_EQ("bar", foo); 11724 EXPECT_EQ("bar", foo);
11725 } 11725 }
11726 11726
11727 } // namespace net 11727 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache.cc ('k') | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698