Index: chrome/browser/translate/scoped_cld_data_harness.h |
diff --git a/chrome/browser/translate/translate_browser_test_utils.h b/chrome/browser/translate/scoped_cld_data_harness.h |
similarity index 58% |
rename from chrome/browser/translate/translate_browser_test_utils.h |
rename to chrome/browser/translate/scoped_cld_data_harness.h |
index c8ad85a5d4d1c2de0f501ede5ad9681480a30aa3..3455b30b26382d5b329563f82fdcb92473bdf3ab 100644 |
--- a/chrome/browser/translate/translate_browser_test_utils.h |
+++ b/chrome/browser/translate/scoped_cld_data_harness.h |
@@ -2,10 +2,12 @@ |
// 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_ |
+#ifndef CHROME_BROWSER_TRANSLATE_SCOPED_CLD_DATA_HARNESS_H_ |
+#define CHROME_BROWSER_TRANSLATE_SCOPED_CLD_DATA_HARNESS_H_ |
+#include "base/files/file_path.h" |
#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
namespace test { |
@@ -18,49 +20,47 @@ namespace test { |
// fail gracefully in error conditions. Sample use: |
// |
// IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { |
-// test::ScopedCLDDynamicDataHarness dynamic_data_scope; |
-// ASSERT_NO_FATAL_FAILURE(dynamic_data_scope.Init()); |
+// scoped_ptr<test::ScopedCldDataHarness> cld_data_scope = |
+// test::CreateScopedCldDataHarness(); |
+// ASSERT_NO_FATAL_FAILURE(cld_data_scope.Init()); |
// // ... your code that depends on language detection goes here |
// } |
// |
// If you have a lot of tests that need language translation features, you can |
-// add an instance of the ScopedCLDDynamicDataHarness to your test class' |
-// private member variables and add the call to Init() into SetUpOnMainThread. |
+// add an instance of the ScopedCldDataHarness to your test class' private |
+// member variables and add the call to Init() into SetUpOnMainThread. |
// Sample use: |
// |
// class MyTestClass : public InProcessBrowserTest { |
// public: |
// virtual void SetUpOnMainThread() OVERRIDE { |
-// dynamic_data_scope.Init(); |
+// cld_data_scope.Init(); |
// InProcessBrowserTest::SetUpOnMainThread(); |
// } |
// private: |
-// test::ScopedCLDDynamicDataHarness dynamic_data_scope; |
+// test::ScopedCldDataHarness cld_data_scope; |
// }; |
// |
-class ScopedCLDDynamicDataHarness { |
+class ScopedCldDataHarness { |
public: |
- // Constructs the object, but does nothing. Call Init() to prepare the |
- // harness, and enclose that call in ASSERT_NO_FATAL_FAILURE(...). |
- 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(); |
+ virtual ~ScopedCldDataHarness() {} |
// Call this method, wrapping it in ASSERT_NO_FATAL_FAILURE, to initialize |
- // the harness and trigger test failure of initialization fails. |
- void Init(); |
- |
- private: |
- void ClearStandaloneDataFileState(); |
+ // the harness and trigger test failure if initialization fails. |
+ virtual void Init() = 0; |
- DISALLOW_COPY_AND_ASSIGN(ScopedCLDDynamicDataHarness); |
+ protected: |
Takashi Toyoshima
2014/06/23 08:50:01
Can you add some useful comments on following meth
Andrew Hayden (chromium.org)
2014/06/23 13:20:35
Done.
|
+ const base::FilePath::CharType* GetTestDataSourceCrxVersion(); |
+ void GetTestDataSourceDirectory(base::FilePath* out_path); |
}; |
+scoped_ptr<ScopedCldDataHarness> CreateScopedCldDataHarness(); |
+ |
} // namespace test |
-#endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSER_TEST_UTILS_H_ |
+#endif // CHROME_BROWSER_TRANSLATE_SCOPED_CLD_DATA_HARNESS_H_ |