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

Side by Side Diff: chrome/browser/autofill/data_driven_test.h

Issue 12434004: Move remaining Autofill code to //components/autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix long lines Created 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_AUTOFILL_DATA_DRIVEN_TEST_H_
6 #define CHROME_BROWSER_AUTOFILL_DATA_DRIVEN_TEST_H_
7
8 #include <string>
9
10 #include "base/files/file_path.h"
11 #include "base/string16.h"
12
13 // A convenience class for implementing data-driven tests. Subclassers need only
14 // implement the conversion of serialized input data to serialized output data
15 // and provide a set of input files. For each input file, on the first run, a
16 // gold output file is generated; for subsequent runs, the test ouptut is
17 // compared to this gold output.
18 class DataDrivenTest {
19 public:
20 // For each file in |input_directory| whose filename matches
21 // |file_name_pattern|, slurps in the file contents and calls into
22 // |GenerateResults()|. If the corresponding output file already exists in
23 // the |output_directory|, verifies that the results match the file contents;
24 // otherwise, writes a gold result file to the |output_directory|.
25 void RunDataDrivenTest(const base::FilePath& input_directory,
26 const base::FilePath& output_directory,
27 const base::FilePath::StringType& file_name_pattern);
28
29 // Given the |input| data, generates the |output| results. The output results
30 // must be stable across runs.
31 // Note: The return type is |void| so that googletest |ASSERT_*| macros will
32 // compile.
33 virtual void GenerateResults(const std::string& input,
34 std::string* output) = 0;
35
36 // Return |base::FilePath|s to the test input and output subdirectories
37 // ../autofill/|test_name|/input and ../autofill/|test_name|/output.
38 base::FilePath GetInputDirectory(const base::FilePath::StringType& test_name);
39 base::FilePath GetOutputDirectory(
40 const base::FilePath::StringType& test_name);
41
42 protected:
43 DataDrivenTest();
44 virtual ~DataDrivenTest();
45
46 private:
47 DISALLOW_COPY_AND_ASSIGN(DataDrivenTest);
48 };
49
50 #endif // CHROME_BROWSER_AUTOFILL_DATA_DRIVEN_TEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/crypto/rc4_decryptor.h ('k') | chrome/browser/autofill/data_driven_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698