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

Side by Side Diff: content/browser/download/base_file_unittest.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
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 "content/browser/download/base_file.h" 5 #include "content/browser/download/base_file.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (!expected_error_) { 64 if (!expected_error_) {
65 EXPECT_EQ(static_cast<int64>(expected_data_.size()), 65 EXPECT_EQ(static_cast<int64>(expected_data_.size()),
66 base_file_->bytes_so_far()); 66 base_file_->bytes_so_far());
67 } 67 }
68 68
69 base::FilePath full_path = base_file_->full_path(); 69 base::FilePath full_path = base_file_->full_path();
70 70
71 if (!expected_data_.empty() && !expected_error_) { 71 if (!expected_data_.empty() && !expected_error_) {
72 // Make sure the data has been properly written to disk. 72 // Make sure the data has been properly written to disk.
73 std::string disk_data; 73 std::string disk_data;
74 EXPECT_TRUE(file_util::ReadFileToString(full_path, &disk_data)); 74 EXPECT_TRUE(base::ReadFileToString(full_path, &disk_data));
75 EXPECT_EQ(expected_data_, disk_data); 75 EXPECT_EQ(expected_data_, disk_data);
76 } 76 }
77 77
78 // Make sure the mock BrowserThread outlives the BaseFile to satisfy 78 // Make sure the mock BrowserThread outlives the BaseFile to satisfy
79 // thread checks inside it. 79 // thread checks inside it.
80 base_file_.reset(); 80 base_file_.reset();
81 81
82 EXPECT_EQ(expect_file_survives_, base::PathExists(full_path)); 82 EXPECT_EQ(expect_file_survives_, base::PathExists(full_path));
83 } 83 }
84 84
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 base::FilePath temp_file; 625 base::FilePath temp_file;
626 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), 626 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(),
627 &temp_file)); 627 &temp_file));
628 ASSERT_FALSE(temp_file.empty()); 628 ASSERT_FALSE(temp_file.empty());
629 EXPECT_STREQ(temp_file.DirName().value().c_str(), 629 EXPECT_STREQ(temp_file.DirName().value().c_str(),
630 base_file_->full_path().DirName().value().c_str()); 630 base_file_->full_path().DirName().value().c_str());
631 base_file_->Finish(); 631 base_file_->Finish();
632 } 632 }
633 633
634 } // namespace content 634 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_http_handler_impl.cc ('k') | content/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698