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

Unified Diff: chrome/browser/translate/translate_tab_helper.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: 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_tab_helper.h
diff --git a/chrome/browser/translate/translate_tab_helper.h b/chrome/browser/translate/translate_tab_helper.h
index 10fb138aa9fe6ed2565fcdc9311d6bc5d69c5b23..6e582977b59b4b86bcbc29bb7c031288e3276d29 100644
--- a/chrome/browser/translate/translate_tab_helper.h
+++ b/chrome/browser/translate/translate_tab_helper.h
@@ -26,12 +26,16 @@
namespace base {
class File;
-}
+} // namespace base
namespace content {
class BrowserContext;
class WebContents;
-}
+} // namespace content
+
+namespace test {
+class TranslateBrowserUtilsTest;
+} // namespace test
struct LanguageDetectionDetails;
class PrefService;
@@ -100,6 +104,7 @@ class TranslateTabHelper
private:
explicit TranslateTabHelper(content::WebContents* web_contents);
friend class content::WebContentsUserData<TranslateTabHelper>;
+ friend class test::TranslateBrowserUtilsTest; // For cleaning up static state
Sorin Jianu 2014/05/15 17:16:13 Ends with .
Andrew Hayden (chromium.org) 2014/05/16 17:53:20 Done.
// content::WebContentsObserver implementation.
virtual void NavigationEntryCommitted(
@@ -143,6 +148,12 @@ class TranslateTabHelper
const uint64 data_offset,
const uint64 data_length);
+ // For testing purposes only, clear the s_cached_* state. Leaks the open
Sorin Jianu 2014/05/15 17:16:13 clears
Sorin Jianu 2014/05/15 17:16:13 Since we already have test friendship, would it be
Andrew Hayden (chromium.org) 2014/05/16 17:53:20 Done.
+ // file handle, because renderer processes could be using it and there's no
+ // way to be sure that they aren't. This effectively allows a test harness
+ // to wipe any cached state.
+ static void ClearCLDDataForTest();
+
// The data file, cached as long as the process stays alive.
// We also track the offset at which the data starts, and its length.
static base::File* s_cached_file_; // guarded by file_lock_

Powered by Google App Engine
This is Rietveld 408576698