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

Side by Side Diff: net/url_request/url_fetcher_impl_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/tools/tld_cleanup/tld_cleanup_util.cc ('k') | net/url_request/url_request_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 (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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 ASSERT_TRUE(test_server.Start()); 1426 ASSERT_TRUE(test_server.Start());
1427 1427
1428 base::ScopedTempDir temp_dir; 1428 base::ScopedTempDir temp_dir;
1429 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 1429 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
1430 1430
1431 // Create a file before trying to fetch. 1431 // Create a file before trying to fetch.
1432 static const char kFileToFetch[] = "simple.html"; 1432 static const char kFileToFetch[] = "simple.html";
1433 std::string data(10000, '?'); // Meant to be larger than simple.html. 1433 std::string data(10000, '?'); // Meant to be larger than simple.html.
1434 file_path_ = temp_dir.path().AppendASCII(kFileToFetch); 1434 file_path_ = temp_dir.path().AppendASCII(kFileToFetch);
1435 ASSERT_EQ(static_cast<int>(data.size()), 1435 ASSERT_EQ(static_cast<int>(data.size()),
1436 file_util::WriteFile(file_path_, data.data(), data.size())); 1436 base::WriteFile(file_path_, data.data(), data.size()));
1437 ASSERT_TRUE(base::PathExists(file_path_)); 1437 ASSERT_TRUE(base::PathExists(file_path_));
1438 expected_file_ = test_server.GetDocumentRoot().AppendASCII(kFileToFetch); 1438 expected_file_ = test_server.GetDocumentRoot().AppendASCII(kFileToFetch);
1439 ASSERT_FALSE(base::ContentsEqual(file_path_, expected_file_)); 1439 ASSERT_FALSE(base::ContentsEqual(file_path_, expected_file_));
1440 1440
1441 // Get a small file. 1441 // Get a small file.
1442 CreateFetcherForFile( 1442 CreateFetcherForFile(
1443 test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch), 1443 test_server.GetURL(std::string(kTestServerFilePrefix) + kFileToFetch),
1444 file_path_); 1444 file_path_);
1445 1445
1446 base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). 1446 base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit().
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « net/tools/tld_cleanup/tld_cleanup_util.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698