From d1a05e1cc32e31494af7a62e0395631bef3e1107 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Fri, 20 Aug 2010 15:32:27 -0700 Subject: [PATCH] Fix occasional fails of MailboxFinderTest. Some of the tests run code on the UI thread but check the result on the test thread, without synchronization, which is wrong. Mark the fields volatile to fix it. Change-Id: I917493f10fc9a15da57cfbc1e65e8d8e2cffd850 --- .../email/activity/MailboxFinderTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/src/com/android/email/activity/MailboxFinderTest.java b/tests/src/com/android/email/activity/MailboxFinderTest.java index 18a74697f..2c6e4d820 100644 --- a/tests/src/com/android/email/activity/MailboxFinderTest.java +++ b/tests/src/com/android/email/activity/MailboxFinderTest.java @@ -328,8 +328,8 @@ public class MailboxFinderTest extends InstrumentationTestCase { * A {@link Controller} that remembers if updateMailboxList has been called. */ private static class MockController extends Controller { - public long mPassedAccountId; - public boolean mCalledUpdateMailboxList; + public volatile long mPassedAccountId; + public volatile boolean mCalledUpdateMailboxList; public void reset() { mPassedAccountId = -1; @@ -351,13 +351,13 @@ public class MailboxFinderTest extends InstrumentationTestCase { * Callback that logs what method is called with what arguments. */ private static class MockCallback implements MailboxFinder.Callback { - public boolean mCalledAccountNotFound; - public boolean mCalledAccountSecurityHold; - public boolean mCalledMailboxFound; - public boolean mCalledMailboxNotFound; + public volatile boolean mCalledAccountNotFound; + public volatile boolean mCalledAccountSecurityHold; + public volatile boolean mCalledMailboxFound; + public volatile boolean mCalledMailboxNotFound; - public long mAccountId = -1; - public long mMailboxId = -1; + public volatile long mAccountId = -1; + public volatile long mMailboxId = -1; public boolean isAnyMethodCalled() { return mCalledAccountNotFound || mCalledAccountSecurityHold || mCalledMailboxFound