summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_main.cc4
-rw-r--r--chrome/browser/browser_process_impl.cc2
-rw-r--r--chrome/browser/download/download_manager.cc4
-rw-r--r--chrome/browser/download/save_package.cc4
-rw-r--r--chrome/browser/metrics/metrics_service_uitest.cc4
-rw-r--r--chrome/browser/profile.cc2
-rw-r--r--chrome/browser/tab_contents/web_contents_unittest.cc7
-rw-r--r--chrome/common/chrome_constants.cc2
-rw-r--r--chrome/common/chrome_constants.h2
-rw-r--r--chrome/common/chrome_paths.cc2
-rw-r--r--chrome/common/pref_service.cc62
-rw-r--r--chrome/common/pref_service.h11
-rw-r--r--chrome/common/pref_service_unittest.cc40
-rw-r--r--chrome/test/data/pref_service/read.json3
-rw-r--r--chrome/test/data/pref_service/write.golden.json1
-rw-r--r--chrome/test/reliability/page_load_test.cc4
-rw-r--r--chrome/test/testing_profile.h2
-rw-r--r--chrome/test/unit/unit_tests.scons1
18 files changed, 108 insertions, 49 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index fc4513c..28d52b5 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -293,8 +293,8 @@ int BrowserMain(const MainFunctionParams& parameters) {
// inherit and reset the user's setting.
if (!local_state_file_exists &&
parsed_command_line.HasSwitch(switches::kParentProfile)) {
- std::wstring parent_profile =
- parsed_command_line.GetSwitchValue(switches::kParentProfile);
+ FilePath parent_profile = FilePath::FromWStringHack(
+ parsed_command_line.GetSwitchValue(switches::kParentProfile));
PrefService parent_local_state(parent_profile);
parent_local_state.RegisterStringPref(prefs::kApplicationLocale,
std::wstring());
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index c272d75..4afa27b 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -339,7 +339,7 @@ void BrowserProcessImpl::CreateLocalState() {
DCHECK(!created_local_state_ && local_state_.get() == NULL);
created_local_state_ = true;
- std::wstring local_state_path;
+ FilePath local_state_path;
PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
local_state_.reset(new PrefService(local_state_path));
}
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index f46cac5..50f2910 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -302,8 +302,8 @@ void DownloadManager::RegisterUserPrefs(PrefService* prefs) {
&default_download_path)) {
NOTREACHED();
}
- prefs->RegisterStringPref(prefs::kDownloadDefaultDirectory,
- default_download_path.ToWStringHack());
+ prefs->RegisterFilePathPref(prefs::kDownloadDefaultDirectory,
+ default_download_path);
// If the download path is dangerous we forcefully reset it. But if we do
// so we set a flag to make sure we only do it once, to avoid fighting
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index 6af6c05..9f01bd8 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -966,8 +966,8 @@ FilePath SavePackage::GetSuggestNameForSaveAs(PrefService* prefs,
if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS,
&default_save_path))
NOTREACHED();
- prefs->RegisterStringPref(prefs::kSaveFileDefaultDirectory,
- default_save_path.ToWStringHack());
+ prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory,
+ default_save_path);
}
// Get the directory from preference.
diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc
index e782128..b8dde62 100644
--- a/chrome/browser/metrics/metrics_service_uitest.cc
+++ b/chrome/browser/metrics/metrics_service_uitest.cc
@@ -47,8 +47,8 @@ class MetricsServiceTest : public UITest {
// that was saved by the app as it closed. The caller takes ownership of the
// returned PrefService object.
PrefService* GetLocalState() {
- std::wstring local_state_path = user_data_dir();
- file_util::AppendToPath(&local_state_path, chrome::kLocalStateFilename);
+ FilePath local_state_path = FilePath::FromWStringHack(user_data_dir())
+ .Append(chrome::kLocalStateFilename);
PrefService* local_state(new PrefService(local_state_path));
return local_state;
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 710949f..979c263 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -542,7 +542,7 @@ SSLHostState* ProfileImpl::GetSSLHostState() {
PrefService* ProfileImpl::GetPrefs() {
if (!prefs_.get()) {
- prefs_.reset(new PrefService(GetPrefFilePath().ToWStringHack()));
+ prefs_.reset(new PrefService(GetPrefFilePath()));
// The Profile class and ProfileManager class may read some prefs so
// register known prefs as soon as possible.
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc
index 9e595af0..a25c589 100644
--- a/chrome/browser/tab_contents/web_contents_unittest.cc
+++ b/chrome/browser/tab_contents/web_contents_unittest.cc
@@ -42,11 +42,10 @@ class WebContentsTestingProfile : public TestingProfile {
virtual PrefService* GetPrefs() {
if (!prefs_.get()) {
- std::wstring source_path;
+ FilePath source_path;
PathService::Get(chrome::DIR_TEST_DATA, &source_path);
- file_util::AppendToPath(&source_path, L"profiles");
- file_util::AppendToPath(&source_path, L"chrome_prefs");
- file_util::AppendToPath(&source_path, L"Preferences");
+ source_path = source_path.AppendASCII("profiles")
+ .AppendASCII("chrome_prefs").AppendASCII("Preferences");
prefs_.reset(new PrefService(source_path));
Profile::RegisterUserPrefs(prefs_.get());
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index 5deca64..658a243 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -38,7 +38,7 @@ const FilePath::CharType kOffTheRecordMediaCacheDirname[] =
const wchar_t kChromePluginDataDirname[] = L"Plugin Data";
const FilePath::CharType kCookieFilename[] = FPL("Cookies");
const FilePath::CharType kHistoryFilename[] = FPL("History");
-const wchar_t kLocalStateFilename[] = L"Local State";
+const FilePath::CharType kLocalStateFilename[] = FPL("Local State");
const FilePath::CharType kPreferencesFilename[] = FPL("Preferences");
const FilePath::CharType kSafeBrowsingFilename[] = FPL("Safe Browsing");
const wchar_t kThumbnailsFilename[] = L"Thumbnails";
diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h
index a5d6cd0..9a929fb 100644
--- a/chrome/common/chrome_constants.h
+++ b/chrome/common/chrome_constants.h
@@ -31,7 +31,7 @@ extern const FilePath::CharType kOffTheRecordMediaCacheDirname[];
extern const wchar_t kChromePluginDataDirname[];
extern const FilePath::CharType kCookieFilename[];
extern const FilePath::CharType kHistoryFilename[];
-extern const wchar_t kLocalStateFilename[];
+extern const FilePath::CharType kLocalStateFilename[];
extern const FilePath::CharType kPreferencesFilename[];
extern const FilePath::CharType kSafeBrowsingFilename[];
extern const wchar_t kThumbnailsFilename[];
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index f9c12be..9b3f8ce 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -131,7 +131,7 @@ bool PathProvider(int key, FilePath* result) {
case chrome::FILE_LOCAL_STATE:
if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
return false;
- cur = cur.AppendASCII(WideToASCII(chrome::kLocalStateFilename));
+ cur = cur.Append(chrome::kLocalStateFilename);
break;
case chrome::FILE_RECORDED_SCRIPT:
if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
diff --git a/chrome/common/pref_service.cc b/chrome/common/pref_service.cc
index b728a87..fd6cef7 100644
--- a/chrome/common/pref_service.cc
+++ b/chrome/common/pref_service.cc
@@ -27,7 +27,7 @@ static const int kCommitIntervalMs = 10000;
// preferences to be written to disk on a background thread.
class SaveLaterTask : public Task {
public:
- SaveLaterTask(const std::wstring& file_name,
+ SaveLaterTask(const FilePath& file_name,
const std::string& data)
: file_name_(file_name),
data_(data) {
@@ -36,7 +36,7 @@ class SaveLaterTask : public Task {
void Run() {
// Write the data to a temp file then rename to avoid data loss if we crash
// while writing the file.
- std::wstring tmp_file_name = file_name_ + L".tmp";
+ FilePath tmp_file_name(file_name_.value() + FILE_PATH_LITERAL(".tmp"));
int bytes_written = file_util::WriteFile(tmp_file_name, data_.c_str(),
static_cast<int>(data_.length()));
if (bytes_written != -1) {
@@ -50,7 +50,7 @@ class SaveLaterTask : public Task {
}
private:
- std::wstring file_name_;
+ FilePath file_name_;
std::string data_;
DISALLOW_COPY_AND_ASSIGN(SaveLaterTask);
@@ -105,7 +105,7 @@ PrefService::PrefService()
save_preferences_factory_(NULL) {
}
-PrefService::PrefService(const std::wstring& pref_filename)
+PrefService::PrefService(const FilePath& pref_filename)
: persistent_(new DictionaryValue),
transient_(new DictionaryValue),
pref_filename_(pref_filename),
@@ -132,7 +132,7 @@ PrefService::~PrefService() {
pref_observers_.clear();
}
-bool PrefService::LoadPersistentPrefs(const std::wstring& file_path) {
+bool PrefService::LoadPersistentPrefs(const FilePath& file_path) {
#if defined(OS_WIN)
DCHECK(!file_path.empty());
#else
@@ -145,7 +145,7 @@ bool PrefService::LoadPersistentPrefs(const std::wstring& file_path) {
#endif
DCHECK(CalledOnValidThread());
- JSONFileValueSerializer serializer(file_path);
+ JSONFileValueSerializer serializer(file_path.ToWStringHack());
scoped_ptr<Value> root(serializer.Deserialize(NULL));
if (!root.get())
return false;
@@ -161,7 +161,7 @@ bool PrefService::LoadPersistentPrefs(const std::wstring& file_path) {
void PrefService::ReloadPersistentPrefs() {
DCHECK(CalledOnValidThread());
- JSONFileValueSerializer serializer(pref_filename_);
+ JSONFileValueSerializer serializer(pref_filename_.ToWStringHack());
scoped_ptr<Value> root(serializer.Deserialize(NULL));
if (!root.get())
return;
@@ -239,6 +239,13 @@ void PrefService::RegisterStringPref(const wchar_t* path,
RegisterPreference(pref);
}
+void PrefService::RegisterFilePathPref(const wchar_t* path,
+ const FilePath& default_value) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ Value::CreateStringValue(default_value.value()));
+ RegisterPreference(pref);
+}
+
void PrefService::RegisterListPref(const wchar_t* path) {
Preference* pref = new Preference(persistent_.get(), path,
new ListValue);
@@ -357,6 +364,27 @@ std::wstring PrefService::GetString(const wchar_t* path) const {
return result;
}
+FilePath PrefService::GetFilePath(const wchar_t* path) const {
+ DCHECK(CalledOnValidThread());
+
+ FilePath::StringType result;
+ if (transient_->GetString(path, &result))
+ return FilePath(result);
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+#if defined(OS_WIN)
+ DCHECK(false) << "Trying to read an unregistered pref: " << path;
+#else
+ // TODO(port): remove this exception
+#endif
+ return FilePath(result);
+ }
+ bool rv = pref->GetValue()->GetAsString(&result);
+ DCHECK(rv);
+ return FilePath(result);
+}
+
bool PrefService::HasPrefPath(const wchar_t* path) const {
Value* value = NULL;
return (transient_->Get(path, &value) || persistent_->Get(path, &value));
@@ -562,6 +590,26 @@ void PrefService::SetString(const wchar_t* path, const std::wstring& value) {
FireObserversIfChanged(path, old_value.get());
}
+void PrefService::SetFilePath(const wchar_t* path, const FilePath& value) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ DCHECK(false) << "Trying to write an unregistered pref: " << path;
+ return;
+ }
+ if (pref->type() != Value::TYPE_STRING) {
+ DCHECK(false) << "Wrong type for SetFilePath: " << path;
+ return;
+ }
+
+ scoped_ptr<Value> old_value(GetPrefCopy(path));
+ bool rv = persistent_->SetString(path, value.value());
+ DCHECK(rv);
+
+ FireObserversIfChanged(path, old_value.get());
+}
+
DictionaryValue* PrefService::GetMutableDictionary(const wchar_t* path) {
DCHECK(CalledOnValidThread());
diff --git a/chrome/common/pref_service.h b/chrome/common/pref_service.h
index 8cc375f..0a7690c 100644
--- a/chrome/common/pref_service.h
+++ b/chrome/common/pref_service.h
@@ -17,6 +17,7 @@
#include <set>
+#include "base/file_path.h"
#include "base/hash_tables.h"
#include "base/non_thread_safe.h"
#include "base/observer_list.h"
@@ -76,7 +77,7 @@ class PrefService : public NonThreadSafe {
};
// |pref_filename| is the path to the prefs file we will try to load or save to.
- explicit PrefService(const std::wstring& pref_filename);
+ explicit PrefService(const FilePath& pref_filename);
~PrefService();
// Reloads the data from file. This should only be called when the importer
@@ -108,6 +109,8 @@ class PrefService : public NonThreadSafe {
double default_value);
void RegisterStringPref(const wchar_t* path,
const std::wstring& default_value);
+ void RegisterFilePathPref(const wchar_t* path,
+ const FilePath& default_value);
void RegisterListPref(const wchar_t* path);
void RegisterDictionaryPref(const wchar_t* path);
@@ -131,6 +134,7 @@ class PrefService : public NonThreadSafe {
int GetInteger(const wchar_t* path) const;
double GetReal(const wchar_t* path) const;
std::wstring GetString(const wchar_t* path) const;
+ FilePath GetFilePath(const wchar_t* path) const;
// Returns the branch if it exists. If it's not a branch or the branch does
// not exist, returns NULL. This does
@@ -150,6 +154,7 @@ class PrefService : public NonThreadSafe {
void SetInteger(const wchar_t* path, int value);
void SetReal(const wchar_t* path, double value);
void SetString(const wchar_t* path, const std::wstring& value);
+ void SetFilePath(const wchar_t* path, const FilePath& value);
// Used to set the value of dictionary or list values in the pref tree. This
// will create a dictionary or list if one does not exist in the pref tree.
@@ -196,7 +201,7 @@ class PrefService : public NonThreadSafe {
PrefService();
// Reads the data from the given file, returning true on success.
- bool LoadPersistentPrefs(const std::wstring& file_path);
+ bool LoadPersistentPrefs(const FilePath& file_path);
// Add a preference to the PreferenceMap. If the pref already exists, return
// false. This method takes ownership of |pref|.
@@ -218,7 +223,7 @@ class PrefService : public NonThreadSafe {
scoped_ptr<DictionaryValue> transient_;
// The filename that we're loading/saving the prefs to.
- std::wstring pref_filename_;
+ FilePath pref_filename_;
// Task used by ScheduleSavePersistentPrefs to avoid lots of little saves.
ScopedRunnableMethodFactory<PrefService> save_preferences_factory_;
diff --git a/chrome/common/pref_service_unittest.cc b/chrome/common/pref_service_unittest.cc
index 48b707a..2a43e69 100644
--- a/chrome/common/pref_service_unittest.cc
+++ b/chrome/common/pref_service_unittest.cc
@@ -20,26 +20,26 @@ protected:
virtual void SetUp() {
// Name a subdirectory of the temp directory.
ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &test_dir_));
- file_util::AppendToPath(&test_dir_, L"PrefServiceTest");
+ test_dir_ = test_dir_.AppendASCII("PrefServiceTest");
// Create a fresh, empty copy of this directory.
file_util::Delete(test_dir_, true);
file_util::CreateDirectory(test_dir_);
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_));
- file_util::AppendToPath(&data_dir_, L"pref_service");
+ data_dir_ = data_dir_.AppendASCII("pref_service");
ASSERT_TRUE(file_util::PathExists(data_dir_));
}
virtual void TearDown() {
// Clean up test directory
- ASSERT_TRUE(file_util::Delete(test_dir_, false));
+ ASSERT_TRUE(file_util::Delete(test_dir_, true));
ASSERT_FALSE(file_util::PathExists(test_dir_));
}
// the path to temporary directory used to contain the test operations
- std::wstring test_dir_;
+ FilePath test_dir_;
// the path to the directory where the test data is stored
- std::wstring data_dir_;
+ FilePath data_dir_;
};
class TestPrefObserver : public NotificationObserver {
@@ -87,13 +87,11 @@ TEST_F(PrefServiceTest, Basic) {
PrefService prefs;
// Test that it fails on nonexistent file.
- std::wstring bogus_input_file = data_dir_;
- file_util::AppendToPath(&bogus_input_file, L"read.txt");
+ FilePath bogus_input_file = data_dir_.AppendASCII("read.txt");
EXPECT_FALSE(prefs.LoadPersistentPrefs(bogus_input_file));
// Test that the persistent value can be loaded.
- std::wstring input_file = data_dir_;
- file_util::AppendToPath(&input_file, L"read.json");
+ FilePath input_file = data_dir_.AppendASCII("read.json");
ASSERT_TRUE(file_util::PathExists(input_file));
ASSERT_TRUE(prefs.LoadPersistentPrefs(input_file));
@@ -110,6 +108,10 @@ TEST_F(PrefServiceTest, Basic) {
EXPECT_EQ(cnn, prefs.GetString(prefs::kHomePage));
+ const wchar_t kSomeDirectory[] = L"some_directory";
+ FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/"));
+ prefs.RegisterFilePathPref(kSomeDirectory, FilePath());
+
// Now test that the transient value overrides the persistent value,
// without actually altering the persistent store.
EXPECT_TRUE(prefs.transient()->SetString(prefs::kHomePage, microsoft));
@@ -128,13 +130,16 @@ TEST_F(PrefServiceTest, Basic) {
prefs.SetInteger(kMaxTabs, 10);
EXPECT_EQ(10, prefs.GetInteger(kMaxTabs));
+ EXPECT_EQ(FilePath::StringType(FILE_PATH_LITERAL("/usr/local/")),
+ prefs.GetFilePath(kSomeDirectory).value());
+ prefs.SetFilePath(kSomeDirectory, some_path);
+ EXPECT_EQ(some_path.value(), prefs.GetFilePath(kSomeDirectory).value());
+
// Serialize and compare to expected output.
- std::wstring output_file = test_dir_;
- file_util::AppendToPath(&output_file, L"write.json");
+ FilePath output_file = test_dir_.AppendASCII("write.json");
prefs.pref_filename_ = output_file;
ASSERT_TRUE(prefs.SavePersistentPrefs(NULL));
- std::wstring golden_output_file = data_dir_;
- file_util::AppendToPath(&golden_output_file, L"write.golden.json");
+ FilePath golden_output_file = data_dir_.AppendASCII("write.golden.json");
ASSERT_TRUE(file_util::PathExists(golden_output_file));
ASSERT_TRUE(file_util::ContentsEqual(golden_output_file, output_file));
}
@@ -151,8 +156,7 @@ TEST_F(PrefServiceTest, Overlay) {
PrefService prefs;
- std::wstring persistent_file = data_dir_;
- file_util::AppendToPath(&persistent_file, L"overlay.json");
+ FilePath persistent_file = data_dir_.AppendASCII("overlay.json");
EXPECT_TRUE(prefs.LoadPersistentPrefs(persistent_file));
Value* transient_value;
@@ -278,8 +282,7 @@ TEST_F(PrefServiceTest, Overlay) {
TEST_F(PrefServiceTest, Observers) {
PrefService prefs;
- std::wstring input_file = data_dir_;
- file_util::AppendToPath(&input_file, L"read.json");
+ FilePath input_file = data_dir_.AppendASCII("read.json");
EXPECT_TRUE(file_util::PathExists(input_file));
EXPECT_TRUE(prefs.LoadPersistentPrefs(input_file));
@@ -319,6 +322,8 @@ TEST_F(PrefServiceTest, Observers) {
prefs.RemovePrefObserver(pref_name, &obs2);
}
+// TODO(port): port this test to POSIX.
+#if defined(OS_WIN)
TEST_F(PrefServiceTest, LocalizedPrefs) {
PrefService prefs;
const wchar_t kBoolean[] = L"boolean";
@@ -340,6 +345,7 @@ TEST_F(PrefServiceTest, LocalizedPrefs) {
prefs.SetString(kString, L"foo");
EXPECT_EQ(L"foo", prefs.GetString(kString));
}
+#endif
TEST_F(PrefServiceTest, NoObserverFire) {
PrefService prefs;
diff --git a/chrome/test/data/pref_service/read.json b/chrome/test/data/pref_service/read.json
index 0225f17..ea578a4 100644
--- a/chrome/test/data/pref_service/read.json
+++ b/chrome/test/data/pref_service/read.json
@@ -1,7 +1,8 @@
{
"homepage": "http://www.cnn.com",
+ "some_directory": "/usr/local/",
"tabs": {
"new_windows_in_tabs": true,
"max_tabs": 20
}
-} \ No newline at end of file
+}
diff --git a/chrome/test/data/pref_service/write.golden.json b/chrome/test/data/pref_service/write.golden.json
index 116775b..362e32d 100644
--- a/chrome/test/data/pref_service/write.golden.json
+++ b/chrome/test/data/pref_service/write.golden.json
@@ -1,5 +1,6 @@
{
"homepage": "http://www.cnn.com",
+ "some_directory": "/usr/sbin/",
"tabs": {
"max_tabs": 10,
"new_windows_in_tabs": false
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index 2ee9470..32a234c 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -479,8 +479,8 @@ class PageLoadTest : public UITest {
// that was saved by the app as it closed. The caller takes ownership of the
// returned PrefService object.
PrefService* GetLocalState() {
- std::wstring local_state_path = user_data_dir();
- file_util::AppendToPath(&local_state_path, chrome::kLocalStateFilename);
+ FilePath local_state_path = FilePath::FromWStringHack(user_data_dir())
+ .Append(chrome::kLocalStateFilename);
PrefService* local_state(new PrefService(local_state_path));
return local_state;
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index 4601173..ea78459 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -102,7 +102,7 @@ class TestingProfile : public Profile {
prefs_filename =
prefs_filename.Append(FILE_PATH_LITERAL("TestPreferences"));
if (!prefs_.get()) {
- prefs_.reset(new PrefService(prefs_filename.ToWStringHack()));
+ prefs_.reset(new PrefService(prefs_filename));
Profile::RegisterUserPrefs(prefs_.get());
browser::RegisterAllPrefs(prefs_.get(), prefs_.get());
}
diff --git a/chrome/test/unit/unit_tests.scons b/chrome/test/unit/unit_tests.scons
index 7da5419..ab490fd 100644
--- a/chrome/test/unit/unit_tests.scons
+++ b/chrome/test/unit/unit_tests.scons
@@ -429,7 +429,6 @@ if not env.Bit('windows'):
'$CHROME_DIR/common/gfx/emf_unittest.cc',
'$CHROME_DIR/common/gfx/icon_util_unittest.cc',
'$CHROME_DIR/common/os_exchange_data_unittest.cc',
- '$CHROME_DIR/common/pref_service_unittest.cc',
'$CHROME_DIR/common/time_format_unittest.cc',
'$CHROME_DIR/common/win_util_unittest.cc',
'$CHROME_DIR/test/browser_with_test_window_test.cc',