| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/url_request/url_fetcher_impl.h" | 5 #include "net/url_request/url_fetcher_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 fetcher_->SetUploadFilePath("application/x-www-form-urlencoded", | 548 fetcher_->SetUploadFilePath("application/x-www-form-urlencoded", |
| 549 path_, | 549 path_, |
| 550 range_offset_, | 550 range_offset_, |
| 551 range_length_, | 551 range_length_, |
| 552 base::MessageLoopProxy::current()); | 552 base::MessageLoopProxy::current()); |
| 553 fetcher_->Start(); | 553 fetcher_->Start(); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void URLFetcherPostFileTest::OnURLFetchComplete(const URLFetcher* source) { | 556 void URLFetcherPostFileTest::OnURLFetchComplete(const URLFetcher* source) { |
| 557 std::string expected; | 557 std::string expected; |
| 558 ASSERT_TRUE(file_util::ReadFileToString(path_, &expected)); | 558 ASSERT_TRUE(base::ReadFileToString(path_, &expected)); |
| 559 ASSERT_LE(range_offset_, expected.size()); | 559 ASSERT_LE(range_offset_, expected.size()); |
| 560 uint64 expected_size = | 560 uint64 expected_size = |
| 561 std::min(range_length_, expected.size() - range_offset_); | 561 std::min(range_length_, expected.size() - range_offset_); |
| 562 | 562 |
| 563 std::string data; | 563 std::string data; |
| 564 EXPECT_TRUE(source->GetResponseAsString(&data)); | 564 EXPECT_TRUE(source->GetResponseAsString(&data)); |
| 565 EXPECT_EQ(expected.substr(range_offset_, expected_size), data); | 565 EXPECT_EQ(expected.substr(range_offset_, expected_size), data); |
| 566 URLFetcherTest::OnURLFetchComplete(source); | 566 URLFetcherTest::OnURLFetchComplete(source); |
| 567 } | 567 } |
| 568 | 568 |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 | 1532 |
| 1533 base::MessageLoop::current()->RunUntilIdle(); | 1533 base::MessageLoop::current()->RunUntilIdle(); |
| 1534 ASSERT_EQ(kTake[i], base::PathExists(file_path_)) << | 1534 ASSERT_EQ(kTake[i], base::PathExists(file_path_)) << |
| 1535 "FilePath: " << file_path_.value(); | 1535 "FilePath: " << file_path_.value(); |
| 1536 } | 1536 } |
| 1537 } | 1537 } |
| 1538 | 1538 |
| 1539 } // namespace | 1539 } // namespace |
| 1540 | 1540 |
| 1541 } // namespace net | 1541 } // namespace net |
| OLD | NEW |