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

Unified 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: toyoshim@'s comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/translate/translate_browser_test_utils.h
diff --git a/chrome/browser/translate/translate_browser_test_utils.h b/chrome/browser/translate/translate_browser_test_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..7e3548d4b185b88e75a232fd1e1565f7d36edbfe
--- /dev/null
+++ b/chrome/browser/translate/translate_browser_test_utils.h
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSER_TEST_UTILS_H_
+#define CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSER_TEST_UTILS_H_
+
+#include "base/macros.h"
+
+namespace test {
+
+// A utility class that sets up CLD dynamic data when constructed, and cleans
+// it up when destroyed.
+// The test data for this class lives under:
+// src/chrome/test/data/cld2_component
+class ScopedCLDDynamicDataHarness {
+ public:
+ // Invokes whatever dark magic is required in order to make the CLD data
+ // available immediately to testing code. The implementation may vary
+ // depending on the following defines, bypassing any external data access
+ // requirements.
+ ScopedCLDDynamicDataHarness();
+
+ // Reverses the work done by the constructor: any files and/or directories
+ // that would be created by the constructor are immediately and irrevocably
+ // deleted.
+ // If dynamic data is not currently available for any reason, this method has
+ // no net effect on the runtime.
+ ~ScopedCLDDynamicDataHarness();
+
+ private:
+ void ClearStandaloneDataFileState();
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedCLDDynamicDataHarness);
+};
+
+} // namespace test
+
+#endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSER_TEST_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698