summaryrefslogtreecommitdiffstats
path: root/base/prefs
diff options
context:
space:
mode:
authorqsr@chromium.org <qsr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-21 14:08:05 +0000
committerqsr@chromium.org <qsr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-21 14:08:05 +0000
commit8dda17e4af70393f93d8f29c1e574907ebac53b8 (patch)
treee9f410be627368bd1b57e39faeaf7f2786cb4437 /base/prefs
parent84b5464457f316021125410148c324b6b35e7328 (diff)
downloadchromium_src-8dda17e4af70393f93d8f29c1e574907ebac53b8.zip
chromium_src-8dda17e4af70393f93d8f29c1e574907ebac53b8.tar.gz
chromium_src-8dda17e4af70393f93d8f29c1e574907ebac53b8.tar.bz2
Fix flakyness in PrefMemberTest::MoveToThread
In MoveToThread, a thread object is owned by a ref-counted object that is passed around thread. It means the thread object can be deleted on a thread that is not the one that created it, which will trigger a DCHECK. This CL ensures that the second thread is always stopped on the main thread. R=battre@chromium.org BUG=None Review URL: https://chromiumcodereview.appspot.com/11624023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174390 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/prefs')
-rw-r--r--base/prefs/public/pref_member_unittest.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/base/prefs/public/pref_member_unittest.cc b/base/prefs/public/pref_member_unittest.cc
index 4203db3a..eab5a4c 100644
--- a/base/prefs/public/pref_member_unittest.cc
+++ b/base/prefs/public/pref_member_unittest.cc
@@ -56,6 +56,12 @@ class GetPrefValueHelper
event.Wait();
}
+ // The thread must be stopped on the main thread. GetPrefValueHelper being
+ // ref-counted, the destructor can be called from any thread.
+ void StopThread() {
+ pref_thread_.Stop();
+ }
+
bool value() { return value_; }
private:
@@ -313,4 +319,6 @@ TEST(PrefMemberTest, MoveToThread) {
helper->FetchValue();
EXPECT_TRUE(helper->value());
+
+ helper->StopThread();
}