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

Unified Diff: net/url_request/url_fetcher_impl_unittest.cc

Issue 12261025: Revert "Add SetUploadDataStream method to URLFetcher." which broke URLFetcher retries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « net/url_request/url_fetcher_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_fetcher_impl_unittest.cc
diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc
index d49d2c37735955cf1350b1f76214e1ff4f48d01a..5e22ce06a072f76b7c6aea19485de8e8187a8fc1 100644
--- a/net/url_request/url_fetcher_impl_unittest.cc
+++ b/net/url_request/url_fetcher_impl_unittest.cc
@@ -17,8 +17,6 @@
#include "crypto/nss_util.h"
#include "net/base/mock_host_resolver.h"
#include "net/base/network_change_notifier.h"
-#include "net/base/upload_data_stream.h"
-#include "net/base/upload_file_element_reader.h"
#include "net/http/http_response_headers.h"
#include "net/test/test_server.h"
#include "net/url_request/url_fetcher_delegate.h"
@@ -239,22 +237,6 @@ class URLFetcherPostTest : public URLFetcherTest {
virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
};
-// Version of URLFetcherTest that does a POST of a file using
-// SetUploadDataStream
-class URLFetcherPostFileTest : public URLFetcherTest {
- public:
- URLFetcherPostFileTest();
-
- // URLFetcherTest:
- virtual void CreateFetcher(const GURL& url) OVERRIDE;
-
- // URLFetcherDelegate:
- virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
-
- private:
- base::FilePath path_;
-};
-
// Version of URLFetcherTest that does a POST instead with empty upload body
class URLFetcherEmptyPostTest : public URLFetcherTest {
public:
@@ -522,38 +504,6 @@ void URLFetcherPostTest::OnURLFetchComplete(const URLFetcher* source) {
URLFetcherTest::OnURLFetchComplete(source);
}
-URLFetcherPostFileTest::URLFetcherPostFileTest() {
- PathService::Get(base::DIR_SOURCE_ROOT, &path_);
- path_ = path_.Append(FILE_PATH_LITERAL("net"));
- path_ = path_.Append(FILE_PATH_LITERAL("data"));
- path_ = path_.Append(FILE_PATH_LITERAL("url_request_unittest"));
- path_ = path_.Append(FILE_PATH_LITERAL("BullRunSpeech.txt"));
-}
-
-void URLFetcherPostFileTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, URLFetcher::POST, this);
- fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
- io_message_loop_proxy(), request_context()));
- scoped_ptr<UploadElementReader> reader(new UploadFileElementReader(
- base::MessageLoopProxy::current(), path_, 0, kuint64max, base::Time()));
- fetcher_->SetUploadDataStream(
- "application/x-www-form-urlencoded",
- make_scoped_ptr(UploadDataStream::CreateWithReader(reader.Pass(), 0)));
- fetcher_->Start();
-}
-
-void URLFetcherPostFileTest::OnURLFetchComplete(const URLFetcher* source) {
- int64 size = 0;
- ASSERT_EQ(true, file_util::GetFileSize(path_, &size));
- scoped_array<char> expected(new char[size]);
- ASSERT_EQ(size, file_util::ReadFile(path_, expected.get(), size));
-
- std::string data;
- EXPECT_TRUE(source->GetResponseAsString(&data));
- EXPECT_EQ(std::string(&expected[0], size), data);
- URLFetcherTest::OnURLFetchComplete(source);
-}
-
void URLFetcherEmptyPostTest::CreateFetcher(const GURL& url) {
fetcher_ = new URLFetcherImpl(url, URLFetcher::POST, this);
fetcher_->SetRequestContext(new TestURLRequestContextGetter(
@@ -1053,16 +1003,6 @@ TEST_F(URLFetcherPostTest, Basic) {
MessageLoop::current()->Run();
}
-TEST_F(URLFetcherPostFileTest, Basic) {
- TestServer test_server(TestServer::TYPE_HTTP,
- TestServer::kLocalhost,
- base::FilePath(kDocRoot));
- ASSERT_TRUE(test_server.Start());
-
- CreateFetcher(test_server.GetURL("echo"));
- MessageLoop::current()->Run();
-}
-
TEST_F(URLFetcherEmptyPostTest, Basic) {
TestServer test_server(TestServer::TYPE_HTTP,
TestServer::kLocalhost,
« no previous file with comments | « net/url_request/url_fetcher_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698