Skip to content

Commit 10a5722

Browse files
Merge pull request #53 from awslabs/FB-AndroidTesting
Fb android testing
2 parents c5e3eb7 + 30ff452 commit 10a5722

File tree

45 files changed

+575
-394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+575
-394
lines changed
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1+
*.iml
12
.gradle
23
/local.properties
34
/.idea/workspace.xml
45
/.idea/libraries
56
.DS_Store
67
/build
7-
8-
*.apk
9-
*.so
10-
*.ap_
11-
*.class
12-
*.o
13-
bin/
14-
gen/
15-
build/
8+
/captures
9+
.externalNativeBuild
File renamed without changes.

android-tests/app/build.gradle renamed to AndroidSDKTesting/app/build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ apply plugin: 'com.android.application'
33
android {
44
compileSdkVersion 22
55
buildToolsVersion "21.1.2"
6-
76
defaultConfig {
8-
applicationId "aws.coretests"
9-
minSdkVersion 15
7+
applicationId "aws.androidsdktesting"
8+
minSdkVersion 21
109
targetSdkVersion 22
1110
versionCode 1
1211
versionName "1.0"
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1313
}
1414
buildTypes {
1515
release {
@@ -21,5 +21,9 @@ android {
2121

2222
dependencies {
2323
compile fileTree(dir: 'libs', include: ['*.jar'])
24-
compile 'com.android.support:appcompat-v7:22.0.0'
24+
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25+
exclude group: 'com.android.support', module: 'support-annotations'
26+
})
27+
compile 'com.android.support:appcompat-v7:22.2.1'
28+
testCompile 'junit:junit:4.12'
2529
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package aws.androidsdktesting;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumentation test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("aws.androidsdktesting", appContext.getPackageName());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="aws.coretests" >
4-
android:installLocation="preferExternal"
3+
package="aws.androidsdktesting">
54

65
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
76
<uses-permission android:name="android.permission.INTERNET" />
7+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
8+
89
<application
910
android:allowBackup="true"
1011
android:icon="@mipmap/ic_launcher"
1112
android:label="@string/app_name"
12-
android:theme="@style/AppTheme" >
13-
<activity
14-
android:name=".TestActivity"
15-
android:label="@string/app_name" >
13+
android:supportsRtl="true"
14+
android:theme="@style/AppTheme">
15+
<activity android:name=".RunSDKTests">
1616
<intent-filter>
1717
<action android:name="android.intent.action.MAIN" />
1818

@@ -21,4 +21,4 @@
2121
</activity>
2222
</application>
2323

24-
</manifest>
24+
</manifest>

android-tests/app/src/main/java/aws/coretests/TestActivity.java renamed to AndroidSDKTesting/app/src/main/java/aws/androidsdktesting/RunSDKTests.java

Lines changed: 10 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,17 @@
1-
/*
2-
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License").
5-
* You may not use this file except in compliance with the License.
6-
* A copy of the License is located at
7-
*
8-
* http://aws.amazon.com/apache2.0
9-
*
10-
* or in the "license" file accompanying this file. This file is distributed
11-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12-
* express or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
14-
*/
15-
16-
package aws.coretests;
1+
package aws.androidsdktesting;
172

3+
import android.app.Activity;
184
import android.content.Context;
19-
import android.support.v7.app.ActionBarActivity;
5+
import android.os.AsyncTask;
206
import android.os.Bundle;
21-
import android.view.Menu;
22-
import android.view.MenuItem;
7+
import android.support.v7.app.AppCompatActivity;
238
import android.util.Log;
24-
import android.os.AsyncTask;
25-
import android.app.Activity;
269
import java.util.ArrayList;
2710
import java.util.HashMap;
2811
import java.util.Map;
29-
import java.util.List;
3012

31-
public class TestActivity extends ActionBarActivity {
3213

14+
public class RunSDKTests extends AppCompatActivity {
3315

3416
class TestTask extends AsyncTask<String, Void, Boolean> {
3517

@@ -170,17 +152,10 @@ protected void onPostExecute(Boolean testsSucceeded)
170152

171153
static public native int runTests(Context context);
172154

173-
@Override
174-
public void onDestroy()
175-
{
176-
super.onDestroy();
177-
Log.i("AwsNativeSDK", "OnDestroy called!");
178-
}
179-
180155
@Override
181156
protected void onCreate(Bundle savedInstanceState) {
182157
super.onCreate(savedInstanceState);
183-
setContentView(R.layout.activity_test);
158+
setContentView(R.layout.activity_run_sdktests);
184159

185160
String testName = getIntent().getStringExtra("test");
186161
if(testName == null) {
@@ -190,24 +165,9 @@ protected void onCreate(Bundle savedInstanceState) {
190165
}
191166

192167
@Override
193-
public boolean onCreateOptionsMenu(Menu menu) {
194-
// Inflate the menu; this adds items to the action bar if it is present.
195-
getMenuInflater().inflate(R.menu.menu_test, menu);
196-
return true;
197-
}
198-
199-
@Override
200-
public boolean onOptionsItemSelected(MenuItem item) {
201-
// Handle action bar item clicks here. The action bar will
202-
// automatically handle clicks on the Home/Up button, so long
203-
// as you specify a parent activity in AndroidManifest.xml.
204-
int id = item.getItemId();
205-
206-
//noinspection SimplifiableIfStatement
207-
if (id == R.id.action_settings) {
208-
return true;
209-
}
210-
211-
return super.onOptionsItemSelected(item);
168+
public void onDestroy()
169+
{
170+
super.onDestroy();
171+
Log.i("AwsNativeSDK", "OnDestroy called!");
212172
}
213173
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:id="@+id/activity_run_sdktests"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
android:paddingBottom="@dimen/activity_vertical_margin"
8+
android:paddingLeft="@dimen/activity_horizontal_margin"
9+
android:paddingRight="@dimen/activity_horizontal_margin"
10+
android:paddingTop="@dimen/activity_vertical_margin"
11+
tools:context="aws.androidsdktesting.RunSDKTests">
12+
13+
<TextView
14+
android:layout_width="wrap_content"
15+
android:layout_height="wrap_content"
16+
android:text="Hello World!" />
17+
</RelativeLayout>
Loading
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#3F51B5</color>
4+
<color name="colorPrimaryDark">#303F9F</color>
5+
<color name="colorAccent">#FF4081</color>
6+
</resources>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">AndroidSDKTesting</string>
3+
</resources>

android-tests/app/src/main/res/values/styles.xml renamed to AndroidSDKTesting/app/src/main/res/values/styles.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<!-- Base application theme. -->
44
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
55
<!-- Customize your theme here. -->
6+
<item name="colorPrimary">@color/colorPrimary</item>
7+
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8+
<item name="colorAccent">@color/colorAccent</item>
69
</style>
710

811
</resources>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package aws.androidsdktesting;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.*;
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11+
*/
12+
public class ExampleUnitTest {
13+
@Test
14+
public void addition_isCorrect() throws Exception {
15+
assertEquals(4, 2 + 2);
16+
}
17+
}

android-tests/build.gradle renamed to AndroidSDKTesting/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.1.0'
8+
classpath 'com.android.tools.build:gradle:2.2.2'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
@@ -17,3 +17,7 @@ allprojects {
1717
jcenter()
1818
}
1919
}
20+
21+
task clean(type: Delete) {
22+
delete rootProject.buildDir
23+
}

android-tests/gradle.properties renamed to AndroidSDKTesting/gradle.properties

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
12-
# Default value: -Xmx10248m -XX:MaxPermSize=256m
13-
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
12+
org.gradle.jvmargs=-Xmx1536m
1413

1514
# When configured, Gradle will run in incubating parallel mode.
1615
# This option should only be used with decoupled projects. More details, visit
1716
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
17+
# org.gradle.parallel=true
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Apr 10 15:27:10 PDT 2013
1+
#Mon Dec 28 10:00:20 PST 2015
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

android-tests/gradlew renamed to AndroidSDKTesting/gradlew

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ case "`uname`" in
4242
;;
4343
esac
4444

45-
# For Cygwin, ensure paths are in UNIX format before anything is touched.
46-
if $cygwin ; then
47-
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48-
fi
49-
5045
# Attempt to set APP_HOME
5146
# Resolve links: $0 may be a link
5247
PRG="$0"
@@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do
6156
fi
6257
done
6358
SAVED="`pwd`"
64-
cd "`dirname \"$PRG\"`/" >&-
59+
cd "`dirname \"$PRG\"`/" >/dev/null
6560
APP_HOME="`pwd -P`"
66-
cd "$SAVED" >&-
61+
cd "$SAVED" >/dev/null
6762

6863
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
6964

@@ -114,6 +109,7 @@ fi
114109
if $cygwin ; then
115110
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116111
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112+
JAVACMD=`cygpath --unix "$JAVACMD"`
117113

118114
# We build the pattern for arguments to be converted via cygpath
119115
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)