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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 SpawnedTestServer::kLocalhost, | 1451 SpawnedTestServer::kLocalhost, |
1452 base::FilePath(kDocRoot)); | 1452 base::FilePath(kDocRoot)); |
1453 ASSERT_TRUE(test_server.Start()); | 1453 ASSERT_TRUE(test_server.Start()); |
1454 | 1454 |
1455 base::ScopedTempDir temp_dir; | 1455 base::ScopedTempDir temp_dir; |
1456 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 1456 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
1457 | 1457 |
1458 // Create a directory before trying to fetch. | 1458 // Create a directory before trying to fetch. |
1459 static const char kFileToFetch[] = "simple.html"; | 1459 static const char kFileToFetch[] = "simple.html"; |
1460 file_path_ = temp_dir.path().AppendASCII(kFileToFetch); | 1460 file_path_ = temp_dir.path().AppendASCII(kFileToFetch); |
1461 ASSERT_TRUE(file_util::CreateDirectory(file_path_)); | 1461 ASSERT_TRUE(base::CreateDirectory(file_path_)); |
1462 ASSERT_TRUE(base::PathExists(file_path_)); | 1462 ASSERT_TRUE(base::PathExists(file_path_)); |
1463 | 1463 |
1464 // Get a small file. | 1464 // Get a small file. |
1465 expected_file_error_ = ERR_ACCESS_DENIED; | 1465 expected_file_error_ = ERR_ACCESS_DENIED; |
1466 expected_file_ = test_server.GetDocumentRoot().AppendASCII(kFileToFetch); | 1466 expected_file_ = test_server.GetDocumentRoot().AppendASCII(kFileToFetch); |
1467 CreateFetcherForFile( | 1467 CreateFetcherForFile( |
1468 test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch), | 1468 test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch), |
1469 file_path_); | 1469 file_path_); |
1470 | 1470 |
1471 base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). | 1471 base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 | 1529 |
1530 base::MessageLoop::current()->RunUntilIdle(); | 1530 base::MessageLoop::current()->RunUntilIdle(); |
1531 ASSERT_EQ(kTake[i], base::PathExists(file_path_)) << | 1531 ASSERT_EQ(kTake[i], base::PathExists(file_path_)) << |
1532 "FilePath: " << file_path_.value(); | 1532 "FilePath: " << file_path_.value(); |
1533 } | 1533 } |
1534 } | 1534 } |
1535 | 1535 |
1536 } // namespace | 1536 } // namespace |
1537 | 1537 |
1538 } // namespace net | 1538 } // namespace net |
OLD | NEW |