Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 namespace test { | |
| 9 | |
| 10 // A utility class that sets up CLD dynamic data when constructed, and cleans | |
| 11 // it up when destroyed. | |
| 12 class ScopedCLDDynamicDataHarness { | |
| 13 | |
|
Sorin Jianu
2014/05/15 17:16:13
There are some extra white space lines in this cla
Andrew Hayden (chromium.org)
2014/05/16 17:53:20
I'll do a separate lint pass shortly.
| |
| 14 public: | |
| 15 | |
| 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): | |
| 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 // Reverse the work done by the constructor: any files and/or directories | |
|
Sorin Jianu
2014/05/15 17:16:13
Reverses.
Andrew Hayden (chromium.org)
2014/05/16 17:53:20
Done.
| |
| 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: | |
| 46 | |
| 47 // Invoked by the constructor; declared so a friend declaration can be made | |
|
Sorin Jianu
2014/05/15 17:16:13
@47 AND @51, arguably comments not needed.
Where
Andrew Hayden (chromium.org)
2014/05/16 17:53:20
Done. Sorry about the confusion.
| |
| 48 // in the required places to give this class access to private data | |
| 49 void MakeDynamicCLDDataAvailableForTest(); | |
| 50 | |
| 51 // Invoked by the destructor; declared so a friend declaration can be made | |
| 52 // in the required places to give this class access to private data | |
| 53 void MakeDynamicCLDDataUnavailableForTest(); | |
| 54 | |
|
Sorin Jianu
2014/05/15 17:16:13
Do we need to have value semantics in this class?
Andrew Hayden (chromium.org)
2014/05/16 17:53:20
Done.
| |
| 55 }; | |
| 56 | |
| 57 } // namespace test | |
| 58 | |
| 59 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSER_TEST_UTILS_H_ | |
| OLD | NEW |