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

Side by Side Diff: components/autofill/core/browser/data_driven_test.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/data_driven_test.h" 5 #include "components/autofill/core/browser/data_driven_test.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace autofill { 12 namespace autofill {
13 namespace { 13 namespace {
14 14
15 // Reads |file| into |content|, and converts Windows line-endings to Unix ones. 15 // Reads |file| into |content|, and converts Windows line-endings to Unix ones.
16 // Returns true on success. 16 // Returns true on success.
17 bool ReadFile(const base::FilePath& file, std::string* content) { 17 bool ReadFile(const base::FilePath& file, std::string* content) {
18 if (!file_util::ReadFileToString(file, content)) 18 if (!base::ReadFileToString(file, content))
19 return false; 19 return false;
20 20
21 ReplaceSubstringsAfterOffset(content, 0, "\r\n", "\n"); 21 ReplaceSubstringsAfterOffset(content, 0, "\r\n", "\n");
22 return true; 22 return true;
23 } 23 }
24 24
25 // Write |content| to |file|. Returns true on success. 25 // Write |content| to |file|. Returns true on success.
26 bool WriteFile(const base::FilePath& file, const std::string& content) { 26 bool WriteFile(const base::FilePath& file, const std::string& content) {
27 int write_size = file_util::WriteFile(file, content.c_str(), 27 int write_size = file_util::WriteFile(file, content.c_str(),
28 static_cast<int>(content.length())); 28 static_cast<int>(content.length()));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 DataDrivenTest::DataDrivenTest(const base::FilePath& test_data_directory) 86 DataDrivenTest::DataDrivenTest(const base::FilePath& test_data_directory)
87 : test_data_directory_(test_data_directory) { 87 : test_data_directory_(test_data_directory) {
88 } 88 }
89 89
90 DataDrivenTest::~DataDrivenTest() { 90 DataDrivenTest::~DataDrivenTest() {
91 } 91 }
92 92
93 } // namespace autofill 93 } // namespace autofill
OLDNEW
« no previous file with comments | « cloud_print/service/win/cloud_print_service_config.cc ('k') | components/webdata/common/web_database_migration_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698