Skip to content

Commit 9fc3943

Browse files
committed
add test
1 parent a63c15e commit 9fc3943

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#Changelog
22

3+
## 7.0.9 (2015-10-15)
4+
5+
### 修改
6+
* 禁止0字节文件上传
7+
8+
### 修正
9+
* 进度回调在非UI线程
10+
311
## 7.0.8 (2015-10-10)
412

513
### 修改

library/src/androidTest/java/com/qiniu/android/FormUploadTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ public void testNoKey() throws Throwable {
101101
final UploadOptions opt = new UploadOptions(params, null, true, null, null);
102102
runTestOnUiThread(new Runnable() { // THIS IS THE KEY TO SUCCESS
103103
public void run() {
104+
final Thread t = Thread.currentThread();
104105
uploadManager.put("hello".getBytes(), expectKey, TestConfig.token, new UpCompletionHandler() {
105106
public void complete(String k, ResponseInfo rinfo, JSONObject response) {
106107
Log.i("qiniutest", k + rinfo);
107108
key = k;
108109
info = rinfo;
109110
resp = response;
110111
signal.countDown();
112+
Assert.assertSame("not in ui thread", t, Thread.currentThread());
111113
}
112114
}, opt);
113115
}
@@ -133,13 +135,15 @@ public void testInvalidToken() throws Throwable {
133135
final String expectKey = "你好";
134136
runTestOnUiThread(new Runnable() { // THIS IS THE KEY TO SUCCESS
135137
public void run() {
138+
final Thread t = Thread.currentThread();
136139
uploadManager.put("hello".getBytes(), expectKey, "invalid", new UpCompletionHandler() {
137140
public void complete(String k, ResponseInfo rinfo, JSONObject response) {
138141
Log.i("qiniutest", k + rinfo);
139142
key = k;
140143
info = rinfo;
141144
resp = response;
142145
signal.countDown();
146+
Assert.assertSame("not in ui thread", t, Thread.currentThread());
143147
}
144148
}, null);
145149
}
@@ -188,6 +192,9 @@ public void complete(String k, ResponseInfo rinfo, JSONObject response) {
188192
public void testNoToken() throws Throwable {
189193
final String expectKey = "你好";
190194
runTestOnUiThread(new Runnable() { // THIS IS THE KEY TO SUCCESS
195+
196+
final Thread t = Thread.currentThread();
197+
191198
public void run() {
192199
uploadManager.put(new byte[1], expectKey, null, new UpCompletionHandler() {
193200
public void complete(String k, ResponseInfo rinfo, JSONObject response) {
@@ -196,6 +203,7 @@ public void complete(String k, ResponseInfo rinfo, JSONObject response) {
196203
info = rinfo;
197204
resp = response;
198205
signal.countDown();
206+
Assert.assertSame("not in ui thread", t, Thread.currentThread());
199207
}
200208
}, null);
201209
}
@@ -217,13 +225,17 @@ public void testEmptyToken() throws Throwable {
217225
final String expectKey = "你好";
218226
runTestOnUiThread(new Runnable() { // THIS IS THE KEY TO SUCCESS
219227
public void run() {
228+
229+
final Thread t = Thread.currentThread();
220230
uploadManager.put(new byte[1], expectKey, "", new UpCompletionHandler() {
221231
public void complete(String k, ResponseInfo rinfo, JSONObject response) {
222232
Log.i("qiniutest", k + rinfo);
223233
key = k;
224234
info = rinfo;
225235
resp = response;
226236
signal.countDown();
237+
Assert.assertSame("not in ui thread", t, Thread.currentThread());
238+
227239
}
228240
}, null);
229241
}

library/src/main/java/com/qiniu/android/common/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
public final class Constants {
5-
public static final String VERSION = "7.0.8";
5+
public static final String VERSION = "7.0.9";
66

77
public static final String UTF_8 = "utf-8";
88
}

0 commit comments

Comments
 (0)