mobile/bind: make sure the Java SeqTest has a valid context
On some Android devices (my HTC One S running Android 4.1.1), SeqTest failed the testAssets test because the LoadJNI hack to locate a valid context fails. Instead, make testAssets set up a valid context acquired from InstrumentTestCase. Change-Id: If6e11173dbacff45eb6cb0f409f56cbd88186e30 Reviewed-on: https://go-review.googlesource.com/19896 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
74f88983e7
commit
9ea846d4a9
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
package go;
|
package go;
|
||||||
|
|
||||||
import android.test.AndroidTestCase;
|
import android.test.InstrumentationTestCase;
|
||||||
import android.test.MoreAsserts;
|
import android.test.MoreAsserts;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -12,7 +12,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
import go.testpkg.Testpkg;
|
import go.testpkg.Testpkg;
|
||||||
|
|
||||||
public class SeqTest extends AndroidTestCase {
|
public class SeqTest extends InstrumentationTestCase {
|
||||||
public SeqTest() {
|
public SeqTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +61,8 @@ public class SeqTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testAssets() {
|
public void testAssets() {
|
||||||
|
// Make sure that a valid context is set before reading assets
|
||||||
|
Seq.setContext(getInstrumentation().getContext());
|
||||||
String want = "Hello, Assets.\n";
|
String want = "Hello, Assets.\n";
|
||||||
String got = Testpkg.ReadAsset();
|
String got = Testpkg.ReadAsset();
|
||||||
assertEquals("Asset read", want, got);
|
assertEquals("Asset read", want, got);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user