Changeset View
Changeset View
Standalone View
Standalone View
tests/org/kde/kdeconnect/DeviceTest.java
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
46 | import java.security.KeyPairGenerator; | 46 | import java.security.KeyPairGenerator; | ||
47 | import java.security.cert.X509Certificate; | 47 | import java.security.cert.X509Certificate; | ||
48 | import java.util.Date; | 48 | import java.util.Date; | ||
49 | 49 | | |||
50 | class DeviceTest extends AndroidTestCase { | 50 | class DeviceTest extends AndroidTestCase { | ||
51 | 51 | | |||
52 | // Creating a paired device before each test case | 52 | // Creating a paired device before each test case | ||
53 | @Override | 53 | @Override | ||
54 | protected void setUp() throws Exception { | 54 | protected void setUp() { | ||
55 | super.setUp(); | 55 | super.setUp(); | ||
56 | 56 | | |||
57 | // Dexmaker has problems guessing cache directory, setting manually | 57 | // Dexmaker has problems guessing cache directory, setting manually | ||
58 | System.setProperty("dexmaker.dexcache", getContext().getCacheDir().getPath()); | 58 | System.setProperty("dexmaker.dexcache", getContext().getCacheDir().getPath()); | ||
59 | 59 | | |||
60 | // Save new test device in settings | 60 | // Save new test device in settings | ||
61 | Context context = getContext(); | 61 | Context context = getContext(); | ||
62 | 62 | | |||
Show All 22 Lines | |||||
85 | 85 | | |||
86 | SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE); | 86 | SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE); | ||
87 | preferences.edit().putBoolean(deviceId, true).apply(); | 87 | preferences.edit().putBoolean(deviceId, true).apply(); | ||
88 | } | 88 | } | ||
89 | 89 | | |||
90 | 90 | | |||
91 | // Removing paired device info after each test case | 91 | // Removing paired device info after each test case | ||
92 | @Override | 92 | @Override | ||
93 | protected void tearDown() throws Exception { | 93 | protected void tearDown() { | ||
94 | super.tearDown(); | 94 | super.tearDown(); | ||
95 | 95 | | |||
96 | // Remove saved test device | 96 | // Remove saved test device | ||
97 | Context context = getContext(); | 97 | Context context = getContext(); | ||
98 | 98 | | |||
99 | String deviceId = "testDevice"; | 99 | String deviceId = "testDevice"; | ||
100 | 100 | | |||
101 | SharedPreferences settings = context.getSharedPreferences(deviceId, Context.MODE_PRIVATE); | 101 | SharedPreferences settings = context.getSharedPreferences(deviceId, Context.MODE_PRIVATE); | ||
▲ Show 20 Lines • Show All 180 Lines • Show Last 20 Lines |