forked from github/cordova-android
Updating Activities
This commit is contained in:
parent
c56c73f250
commit
aede2235d0
@ -59,7 +59,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".PhoneGapViewTestActivity" >
|
||||
android:name=".CordovaWebViewTestActivity" >
|
||||
<intent-filter >
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
@ -96,17 +96,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name="org.apache.cordova.test.PhoneGapSplash" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name="org.apache.cordova.test.PhoneGapActivity" >
|
||||
android:name=".CordovaActivity" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
|
@ -1,49 +0,0 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import org.apache.cordova.CordovaWebView;
|
||||
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.test.TouchUtils;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class BackButtonTest extends ActivityInstrumentationTestCase2<backbuttonmultipage> {
|
||||
|
||||
private backbuttonmultipage testActivity;
|
||||
private FrameLayout containerView;
|
||||
private LinearLayout innerContainer;
|
||||
private CordovaWebView testView;
|
||||
private TouchUtils touchTest;
|
||||
private long TIMEOUT = 5000;
|
||||
|
||||
public BackButtonTest() {
|
||||
super("org.apache.cordova.test",backbuttonmultipage.class);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
testActivity = this.getActivity();
|
||||
containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
|
||||
innerContainer = (LinearLayout) containerView.getChildAt(0);
|
||||
testView = (CordovaWebView) innerContainer.getChildAt(0);
|
||||
touchTest = new TouchUtils();
|
||||
}
|
||||
|
||||
public void testPreconditions(){
|
||||
assertNotNull(innerContainer);
|
||||
assertNotNull(testView);
|
||||
}
|
||||
|
||||
public void testClick() {
|
||||
touchTest.tapView(this, testView);
|
||||
}
|
||||
|
||||
private void sleep() {
|
||||
try {
|
||||
Thread.sleep(TIMEOUT );
|
||||
} catch (InterruptedException e) {
|
||||
fail("Unexpected Timeout");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -23,7 +23,7 @@ import org.apache.cordova.DroidGap;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class PhoneGapActivity extends DroidGap {
|
||||
public class CordovaActivity extends DroidGap {
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
@ -26,9 +26,9 @@ import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class CordovaActivityTest extends ActivityInstrumentationTestCase2<PhoneGapActivity> {
|
||||
public class CordovaActivityTest extends ActivityInstrumentationTestCase2<CordovaActivity> {
|
||||
|
||||
private PhoneGapActivity testActivity;
|
||||
private CordovaActivity testActivity;
|
||||
private FrameLayout containerView;
|
||||
private LinearLayout innerContainer;
|
||||
private CordovaWebView testView;
|
||||
@ -36,7 +36,7 @@ public class CordovaActivityTest extends ActivityInstrumentationTestCase2<PhoneG
|
||||
@SuppressWarnings("deprecation")
|
||||
public CordovaActivityTest()
|
||||
{
|
||||
super("org.apache.cordova.test",PhoneGapActivity.class);
|
||||
super("org.apache.cordova.test",CordovaActivity.class);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import org.apache.cordova.CordovaWebView;
|
||||
import com.phonegap.api.PluginManager;
|
||||
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class CordovaSplashTest extends ActivityInstrumentationTestCase2<PhoneGapSplash> {
|
||||
|
||||
private PhoneGapSplash testActivity;
|
||||
private FrameLayout containerView;
|
||||
private LinearLayout innerContainer;
|
||||
private CordovaWebView testView;
|
||||
|
||||
public CordovaSplashTest()
|
||||
{
|
||||
super("com.phonegap.test.activities",PhoneGapSplash.class);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception{
|
||||
super.setUp();
|
||||
testActivity = this.getActivity();
|
||||
containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
|
||||
innerContainer = (LinearLayout) containerView.getChildAt(0);
|
||||
testView = (CordovaWebView) innerContainer.getChildAt(0);
|
||||
|
||||
}
|
||||
|
||||
public void testPreconditions(){
|
||||
assertNotNull(innerContainer);
|
||||
assertNotNull(testView);
|
||||
}
|
||||
|
||||
|
||||
public void testForCordovaView() {
|
||||
String className = testView.getClass().getSimpleName();
|
||||
assertTrue(className.equals("CordovaWebView"));
|
||||
}
|
||||
|
||||
}
|
@ -25,15 +25,15 @@ import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.view.View;
|
||||
|
||||
public class CordovaTest extends
|
||||
ActivityInstrumentationTestCase2<PhoneGapViewTestActivity> {
|
||||
ActivityInstrumentationTestCase2<CordovaWebViewTestActivity> {
|
||||
|
||||
private static final long TIMEOUT = 1000;
|
||||
private PhoneGapViewTestActivity testActivity;
|
||||
private CordovaWebViewTestActivity testActivity;
|
||||
private View testView;
|
||||
private String rString;
|
||||
|
||||
public CordovaTest() {
|
||||
super("com.phonegap.test.activities", PhoneGapViewTestActivity.class);
|
||||
super("com.phonegap.test.activities", CordovaWebViewTestActivity.class);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
|
@ -24,7 +24,7 @@ import org.apache.cordova.CordovaWebView;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class PhoneGapViewTestActivity extends Activity {
|
||||
public class CordovaWebViewTestActivity extends Activity {
|
||||
|
||||
CordovaWebView phoneGap;
|
||||
/** Called when the activity is first created. */
|
@ -24,7 +24,6 @@ public class ErrorUrlTest extends ActivityInstrumentationTestCase2<errorurl> {
|
||||
containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
|
||||
innerContainer = (LinearLayout) containerView.getChildAt(0);
|
||||
testView = (CordovaWebView) innerContainer.getChildAt(0);
|
||||
|
||||
}
|
||||
|
||||
public void testPreconditions(){
|
||||
@ -32,4 +31,11 @@ public class ErrorUrlTest extends ActivityInstrumentationTestCase2<errorurl> {
|
||||
assertNotNull(testView);
|
||||
}
|
||||
|
||||
public void testUrl()
|
||||
{
|
||||
String good_url = "file:///android_asset/www/htmlnotfound/error.html";
|
||||
String url = testView.getUrl();
|
||||
assertTrue(url.equals(good_url));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class GapClientTest extends ActivityInstrumentationTestCase2<PhoneGapViewTestActivity> {
|
||||
public class GapClientTest extends ActivityInstrumentationTestCase2<CordovaWebViewTestActivity> {
|
||||
|
||||
private PhoneGapViewTestActivity testActivity;
|
||||
private CordovaWebViewTestActivity testActivity;
|
||||
private FrameLayout containerView;
|
||||
private LinearLayout innerContainer;
|
||||
private View testView;
|
||||
@ -41,7 +41,7 @@ public class GapClientTest extends ActivityInstrumentationTestCase2<PhoneGapView
|
||||
private CordovaChromeClient appCode;
|
||||
|
||||
public GapClientTest() {
|
||||
super("com.phonegap.test.activities",PhoneGapViewTestActivity.class);
|
||||
super("com.phonegap.test.activities",CordovaWebViewTestActivity.class);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception{
|
||||
|
@ -1,11 +1,41 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import org.apache.cordova.CordovaWebView;
|
||||
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class HtmlNotFoundTest extends ActivityInstrumentationTestCase2<htmlnotfound> {
|
||||
|
||||
|
||||
private htmlnotfound testActivity;
|
||||
private FrameLayout containerView;
|
||||
private LinearLayout innerContainer;
|
||||
private CordovaWebView testView;
|
||||
|
||||
public HtmlNotFoundTest() {
|
||||
super("org.apache.cordova.test",htmlnotfound.class);
|
||||
}
|
||||
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
testActivity = this.getActivity();
|
||||
containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
|
||||
innerContainer = (LinearLayout) containerView.getChildAt(0);
|
||||
testView = (CordovaWebView) innerContainer.getChildAt(0);
|
||||
}
|
||||
|
||||
public void testPreconditions(){
|
||||
assertNotNull(innerContainer);
|
||||
assertNotNull(testView);
|
||||
}
|
||||
|
||||
public void testUrl()
|
||||
{
|
||||
String good_url = "file:///android_asset/www/htmlnotfound/error.html";
|
||||
String url = testView.getUrl();
|
||||
assertFalse(url.equals(good_url));
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import org.apache.cordova.CordovaWebView;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class PhoneGapSplash extends Activity {
|
||||
CordovaWebView phoneGap;
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
phoneGap = (CordovaWebView) findViewById(R.id.phoneGapView);
|
||||
phoneGap.loadUrl("file:///android_asset/index.html", 5000);
|
||||
}
|
||||
|
||||
public void onDestroy()
|
||||
{
|
||||
super.onDestroy();
|
||||
//phoneGap.onDestroy();
|
||||
}
|
||||
}
|
@ -27,9 +27,9 @@ import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class PluginManagerTest extends ActivityInstrumentationTestCase2<PhoneGapViewTestActivity> {
|
||||
public class PluginManagerTest extends ActivityInstrumentationTestCase2<CordovaWebViewTestActivity> {
|
||||
|
||||
private PhoneGapViewTestActivity testActivity;
|
||||
private CordovaWebViewTestActivity testActivity;
|
||||
private FrameLayout containerView;
|
||||
private LinearLayout innerContainer;
|
||||
private View testView;
|
||||
@ -37,7 +37,7 @@ public class PluginManagerTest extends ActivityInstrumentationTestCase2<PhoneGap
|
||||
private PluginManager pMan;
|
||||
|
||||
public PluginManagerTest() {
|
||||
super("com.phonegap.test.activities",PhoneGapViewTestActivity.class);
|
||||
super("com.phonegap.test.activities",CordovaWebViewTestActivity.class);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception{
|
||||
|
Loading…
Reference in New Issue
Block a user