|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 package org.mozilla.gecko.background.testhelpers; |
|
5 |
|
6 import org.mozilla.gecko.sync.Utils; |
|
7 import org.mozilla.gecko.sync.delegates.ClientsDataDelegate; |
|
8 |
|
9 public class MockClientsDataDelegate implements ClientsDataDelegate { |
|
10 private String accountGUID; |
|
11 private String clientName; |
|
12 private int clientsCount; |
|
13 |
|
14 @Override |
|
15 public synchronized String getAccountGUID() { |
|
16 if (accountGUID == null) { |
|
17 accountGUID = Utils.generateGuid(); |
|
18 } |
|
19 return accountGUID; |
|
20 } |
|
21 |
|
22 @Override |
|
23 public synchronized String getClientName() { |
|
24 if (clientName == null) { |
|
25 clientName = "Default Name"; |
|
26 } |
|
27 return clientName; |
|
28 } |
|
29 |
|
30 @Override |
|
31 public synchronized void setClientsCount(int clientsCount) { |
|
32 this.clientsCount = clientsCount; |
|
33 } |
|
34 |
|
35 @Override |
|
36 public synchronized int getClientsCount() { |
|
37 return clientsCount; |
|
38 } |
|
39 |
|
40 @Override |
|
41 public boolean isLocalGUID(String guid) { |
|
42 return getAccountGUID().equals(guid); |
|
43 } |
|
44 } |