Add PathService::RemoveOverride to clear path overrides.
This is especially useful for unit tests because they live in the same process
and share all the singletons including PathService. One can of course override
the overrides but it is much cleaner and sometimes the only good solution to
return to the original PathProvider instead.
BUG=149161
TEST=base_unittests:PathServiceTest.*
Review URL: https://chromiumcodereview.appspot.com/10909228
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158842 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/path_service.h b/base/path_service.h
index e835a1f..40da55a 100644
--- a/base/path_service.h
+++ b/base/path_service.h
@@ -9,6 +9,7 @@
#include "base/base_export.h"
#include "base/base_paths.h"
+#include "base/gtest_prod_util.h"
#include "build/build_config.h"
class FilePath;
@@ -61,10 +62,14 @@
static void RegisterProvider(ProviderFunc provider,
int key_start,
int key_end);
+
private:
- static bool GetFromCache(int key, FilePath* path);
- static bool GetFromOverrides(int key, FilePath* path);
- static void AddToCache(int key, const FilePath& path);
+ FRIEND_TEST_ALL_PREFIXES(PathServiceTest, RemoveOverride);
+
+ // Removes an override for a special directory or file. Returns true if there
+ // was an override to remove or false if none was present.
+ // NOTE: This function is intended to be used by tests only!
+ static bool RemoveOverride(int key);
};
#endif // BASE_PATH_SERVICE_H_