OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.sync; | 5 package org.chromium.chrome.browser.sync; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.test.suitebuilder.annotation.MediumTest; | 8 import android.test.suitebuilder.annotation.MediumTest; |
9 | 9 |
10 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
11 import org.chromium.base.test.util.Feature; | 11 import org.chromium.base.test.util.Feature; |
12 import org.chromium.base.test.util.RetryOnFailure; | 12 import org.chromium.base.test.util.RetryOnFailure; |
13 import org.chromium.chrome.test.util.browser.sync.SyncTestUtil; | 13 import org.chromium.chrome.test.util.browser.sync.SyncTestUtil; |
14 import org.chromium.content.browser.test.util.Criteria; | 14 import org.chromium.content.browser.test.util.Criteria; |
15 import org.chromium.content.browser.test.util.CriteriaHelper; | 15 import org.chromium.content.browser.test.util.CriteriaHelper; |
16 | 16 |
17 import java.util.concurrent.Callable; | 17 import java.util.concurrent.Callable; |
18 | 18 |
19 /** | 19 /** |
20 * Test suite for the GmsCoreSyncListener. | 20 * Test suite for the GmsCoreSyncListener. |
21 */ | 21 */ |
22 @RetryOnFailure // crbug.com/637448 | 22 @RetryOnFailure // crbug.com/637448 |
23 public class GmsCoreSyncListenerTest extends SyncTestBase { | 23 public class GmsCoreSyncListenerTest extends SyncTestBase { |
24 private static final String PASSPHRASE = "passphrase"; | 24 private static final String PASSPHRASE = "passphrase"; |
25 | 25 |
26 static class CountingGmsCoreSyncListener extends GmsCoreSyncListener { | 26 static class CountingGmsCoreSyncListener extends GmsCoreSyncListener { |
27 private int mCallCount = 0; | 27 private int mCallCount; |
28 | 28 |
29 @Override | 29 @Override |
30 public void updateEncryptionKey(byte[] key) { | 30 public void updateEncryptionKey(byte[] key) { |
31 mCallCount++; | 31 mCallCount++; |
32 } | 32 } |
33 | 33 |
34 public int callCount() { | 34 public int callCount() { |
35 return mCallCount; | 35 return mCallCount; |
36 } | 36 } |
37 } | 37 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 private void waitForCallCount(int count) throws InterruptedException { | 124 private void waitForCallCount(int count) throws InterruptedException { |
125 CriteriaHelper.pollUiThread(Criteria.equals(count, new Callable<Integer>
() { | 125 CriteriaHelper.pollUiThread(Criteria.equals(count, new Callable<Integer>
() { |
126 @Override | 126 @Override |
127 public Integer call() { | 127 public Integer call() { |
128 return mListener.callCount(); | 128 return mListener.callCount(); |
129 } | 129 } |
130 })); | 130 })); |
131 } | 131 } |
132 } | 132 } |
OLD | NEW |