mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 739415 - Add ability to have raw files as test assets. r=jmaher
This commit is contained in:
parent
46f7cfbdbd
commit
d0da20efa2
@ -127,8 +127,8 @@ classes.dex: $(_JAVA_TESTS)
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(JAVAFILES) $(_JAVA_HARNESS) $(addprefix $(DEPTH)/mobile/android/base/tests/,$(_JAVA_TESTS))
|
||||
$(DX) --dex --output=$@ classes $(ROBOTIUM_PATH)
|
||||
|
||||
robocop.ap_: AndroidManifest.xml
|
||||
$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -I . -S res -F $@ -J ./
|
||||
robocop.ap_: AndroidManifest.xml $(TESTPATH)/assets/*
|
||||
$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -I . -S res -A $(TESTPATH)/assets -F $@ -J ./
|
||||
|
||||
robocop.apk: robocop.ap_ classes.dex
|
||||
cp $(TESTPATH)/robocop.ini robocop.ini
|
||||
|
@ -6,12 +6,15 @@ import @ANDROID_PACKAGE_NAME@.*;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Instrumentation;
|
||||
import android.database.Cursor;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Intent;
|
||||
import android.content.res.AssetManager;
|
||||
import android.database.Cursor;
|
||||
import android.os.SystemClock;
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@ -204,4 +207,9 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public InputStream getAsset(String filename) throws IOException {
|
||||
AssetManager assets = getInstrumentation().getContext().getAssets();
|
||||
return assets.open(filename);
|
||||
}
|
||||
}
|
||||
|
4
mobile/android/base/tests/assets/README
Normal file
4
mobile/android/base/tests/assets/README
Normal file
@ -0,0 +1,4 @@
|
||||
You can place test assets in this file.
|
||||
They can be read as raw InputStreams with the getAsset() method in BaseTest.
|
||||
|
||||
(This file is a placeholder to ensure that the assets/ directory exists, as it is referenced in the robocop Makefile.)
|
Loading…
Reference in New Issue
Block a user