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

Unified Diff: chrome/browser/prefs/pref_service_unittest.cc

Issue 11027070: Moved JsonPrefStore to use SequencedWorkerPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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/prefs/pref_service_unittest.cc
diff --git a/chrome/browser/prefs/pref_service_unittest.cc b/chrome/browser/prefs/pref_service_unittest.cc
index 782740bcbbf1b9da2ca7818c6add4c6dfe695486..7f128cfdf1d1d78d0be0d1a4b5c23f3361e706ee 100644
--- a/chrome/browser/prefs/pref_service_unittest.cc
+++ b/chrome/browser/prefs/pref_service_unittest.cc
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/api/prefs/pref_change_registrar.h"
@@ -285,6 +286,8 @@ class PrefServiceUserFilePrefsTest : public testing::Test {
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_));
data_dir_ = data_dir_.AppendASCII("pref_service");
ASSERT_TRUE(file_util::PathExists(data_dir_));
+
+ blocking_pool_ = new base::SequencedWorkerPool(1, "TestBlocking");
}
void ClearListValue(PrefService* prefs, const char* key) {
@@ -301,8 +304,10 @@ class PrefServiceUserFilePrefsTest : public testing::Test {
ScopedTempDir temp_dir_;
// The path to the directory where the test data is stored.
FilePath data_dir_;
- // A message loop that we can use as the file thread message loop.
+ // A message loop that we need for firing timers.
MessageLoop message_loop_;
+ // A message loop that we can use as the file thread message loop.
+ scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
};
// Verifies that ListValue and DictionaryValue pref with non emtpy default
@@ -315,7 +320,7 @@ TEST_F(PrefServiceUserFilePrefsTest, PreserveEmptyValue) {
pref_file));
PrefServiceMockBuilder builder;
- builder.WithUserFilePrefs(pref_file, base::MessageLoopProxy::current());
+ builder.WithUserFilePrefs(pref_file, blocking_pool_.get());
scoped_ptr<PrefService> prefs(builder.Create());
// Register testing prefs.
@@ -344,7 +349,7 @@ TEST_F(PrefServiceUserFilePrefsTest, PreserveEmptyValue) {
// Write to file.
prefs->CommitPendingWrite();
- MessageLoop::current()->RunAllPending();
+ blocking_pool_->Shutdown();
// Compare to expected output.
FilePath golden_output_file =

Powered by Google App Engine
This is Rietveld 408576698