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

Side by Side Diff: chrome/browser/translate/translate_browser_test_utils.h

Issue 285293004: Allow browser tests to run with dynamic CLD data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cld_uma
Patch Set: Format Created 6 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
OLDNEW
(Empty)
1 // Copyright 2014 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_TRANSLATE_TRANSLATE_BROWSER_TEST_UTILS_H_
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSER_TEST_UTILS_H_
7
8 #include "base/macros.h"
9
10 namespace test {
11
12 // A utility class that sets up CLD dynamic data when constructed, and cleans
13 // it up when destroyed.
14 class ScopedCLDDynamicDataHarness {
15 public:
16 // Invokes whatever dark magic is required in order to make the CLD data
17 // available immediately to testing code. The implementation may vary
18 // depending on the following defines, bypassing any external data access
19 // requirements. In pseudocode, this looks like the following:
20 //
21 // CLD_VERSION=2 && defined(CLD2_DYNAMIC_MODE) && !defined(CLD2_IS_COMPONENT):
Takashi Toyoshima 2014/05/19 14:32:24 I feel these comments are not useful for developer
Andrew Hayden (chromium.org) 2014/05/19 15:14:21 Done.
22 // Copy the CLD data file from test data into it's default location:
23 // ${chrome::DIR_USER_DATA}/${chrome::kCLDDataFilename}
24 //
25 // CLD_VERSION=2 && defined(CLD2_DYNAMIC_MODE) && defined(CLD2_IS_COMPONENT):
26 // Copy the CLD CRX contents from test data into a realistic location:
27 // ${chrome::DIR_USER_DATA}/${chrome::DIR_COMPONENT_CLD2}/${VERSION}
28 // Call CldComponentInstallerTraits::SetLatestCldDataFile(...)
29 //
30 // In all other cases, the code does nothing because the CLD data is already
31 // statically linked into the executable.
32 //
33 // The data for this class lives under:
34 // src/chrome/test/data/cld2_component
35 ScopedCLDDynamicDataHarness();
36
37 // Reverses the work done by the constructor: any files and/or directories
38 // that would be created by the constructor are immediately and irrevocably
39 // deleted.
40 //
41 // If dynamic data is not currently available for any reason, this method has
42 // no net effect on the runtime.
43 ~ScopedCLDDynamicDataHarness();
44
45 private:
Takashi Toyoshima 2014/05/19 14:32:24 These three methods can be static, or functions in
Andrew Hayden (chromium.org) 2014/05/19 15:14:21 Done.
46 void MakeDynamicCLDDataAvailableForTest();
47 void MakeDynamicCLDDataUnavailableForTest();
48 void ClearStandaloneFileState();
49
50 DISALLOW_COPY_AND_ASSIGN(ScopedCLDDynamicDataHarness);
51 };
52
53 } // namespace test
54
55 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSER_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698