Commit a2e11492 authored by emaxx's avatar emaxx Committed by Commit bot

Override user data directory to the temp for ProfileInfoCacheTest.

Currently the tests of this suite (or, at least,
DownloadHighResAvatarTest) read and write to the default system-wide
location, which is not good and can cause tests flakiness.

Now we override the DIR_USER_DATA to a temporary directory instead.

BUG=486785

Review URL: https://codereview.chromium.org/1138003004

Cr-Commit-Position: refs/heads/master@{#329429}
parent ce403422
......@@ -18,6 +18,7 @@
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_browser_process.h"
......@@ -88,7 +89,8 @@ ProfileInfoCache* ProfileNameVerifierObserver::GetCache() {
ProfileInfoCacheTest::ProfileInfoCacheTest()
: testing_profile_manager_(TestingBrowserProcess::GetGlobal()),
name_observer_(&testing_profile_manager_) {
name_observer_(&testing_profile_manager_),
user_data_dir_override_(chrome::DIR_USER_DATA) {
}
ProfileInfoCacheTest::~ProfileInfoCacheTest() {
......@@ -556,7 +558,7 @@ TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) {
ProfileInfoCache profile_info_cache(g_browser_process->local_state(),
testing_profile_manager_.profile_manager()->user_data_dir());
// // Make sure there are no avatars already on disk.
// Make sure there are no avatars already on disk.
const size_t kIconIndex = 0;
base::FilePath icon_path =
profiles::GetPathOfHighResAvatarAtIndex(kIconIndex);
......
......@@ -7,6 +7,7 @@
#include <set>
#include "base/test/scoped_path_override.h"
#include "chrome/browser/profiles/profile_info_cache_observer.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/test/test_browser_thread_bundle.h"
......@@ -60,6 +61,7 @@ class ProfileInfoCacheTest : public testing::Test {
private:
content::TestBrowserThreadBundle thread_bundle_;
ProfileNameVerifierObserver name_observer_;
base::ScopedPathOverride user_data_dir_override_;
};
#endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_UNITTEST_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment