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

Side by Side Diff: components/autofill/browser/data_driven_test.cc

Issue 13165005: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge, fixes Created 7 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/data_driven_test.h" 5 #include "components/autofill/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/path_service.h" 9 #include "base/path_service.h"
9 #include "base/string_util.h" 10 #include "base/string_util.h"
10 #include "chrome/common/chrome_paths.h" 11 #include "chrome/common/chrome_paths.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace autofill { 14 namespace autofill {
14 namespace { 15 namespace {
15 16
16 // Reads |file| into |content|, and converts Windows line-endings to Unix ones. 17 // Reads |file| into |content|, and converts Windows line-endings to Unix ones.
17 // Returns true on success. 18 // Returns true on success.
(...skipping 11 matching lines...) Expand all
29 content.length()); 30 content.length());
30 return write_size == static_cast<int>(content.length()); 31 return write_size == static_cast<int>(content.length());
31 } 32 }
32 33
33 } // namespace 34 } // namespace
34 35
35 void DataDrivenTest::RunDataDrivenTest( 36 void DataDrivenTest::RunDataDrivenTest(
36 const base::FilePath& input_directory, 37 const base::FilePath& input_directory,
37 const base::FilePath& output_directory, 38 const base::FilePath& output_directory,
38 const base::FilePath::StringType& file_name_pattern) { 39 const base::FilePath::StringType& file_name_pattern) {
39 file_util::FileEnumerator input_files(input_directory, 40 base::FileEnumerator input_files(input_directory,
40 false, 41 false,
41 file_util::FileEnumerator::FILES, 42 base::FileEnumerator::FILES,
42 file_name_pattern); 43 file_name_pattern);
43 44
44 for (base::FilePath input_file = input_files.Next(); 45 for (base::FilePath input_file = input_files.Next();
45 !input_file.empty(); 46 !input_file.empty();
46 input_file = input_files.Next()) { 47 input_file = input_files.Next()) {
47 SCOPED_TRACE(input_file.BaseName().value()); 48 SCOPED_TRACE(input_file.BaseName().value());
48 49
49 std::string input; 50 std::string input;
50 ASSERT_TRUE(ReadFile(input_file, &input)); 51 ASSERT_TRUE(ReadFile(input_file, &input));
51 52
52 std::string output; 53 std::string output;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return test_data_dir_; 85 return test_data_dir_;
85 } 86 }
86 87
87 DataDrivenTest::DataDrivenTest() { 88 DataDrivenTest::DataDrivenTest() {
88 } 89 }
89 90
90 DataDrivenTest::~DataDrivenTest() { 91 DataDrivenTest::~DataDrivenTest() {
91 } 92 }
92 93
93 } // namespace autofill 94 } // namespace autofill
OLDNEW
« no previous file with comments | « cloud_print/virtual_driver/win/virtual_driver.gypi ('k') | content/browser/gpu/gpu_pixel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698