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

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

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

Powered by Google App Engine
This is Rietveld 408576698