Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 package org.mozilla.gecko.background.sync.helpers;
6 import static junit.framework.Assert.assertEquals;
7 import static junit.framework.Assert.assertFalse;
9 import java.util.Arrays;
10 import java.util.HashSet;
11 import java.util.Set;
13 import junit.framework.AssertionFailedError;
15 public class ExpectGuidsSinceDelegate extends DefaultGuidsSinceDelegate {
16 private String[] expected;
17 public Set<String> ignore = new HashSet<String>();
19 public ExpectGuidsSinceDelegate(String[] guids) {
20 expected = guids;
21 Arrays.sort(expected);
22 }
24 @Override
25 public void onGuidsSinceSucceeded(String[] guids) {
26 AssertionFailedError err = null;
27 try {
28 int notIgnored = 0;
29 for (String guid : guids) {
30 if (!ignore.contains(guid)) {
31 notIgnored++;
32 assertFalse(-1 == Arrays.binarySearch(this.expected, guid));
33 }
34 }
35 assertEquals(this.expected.length, notIgnored);
36 } catch (AssertionFailedError e) {
37 err = e;
38 }
39 performNotify(err);
40 }
41 }