You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/07/10 16:30:43 UTC
[09/11] android commit: Update unit tests to not use most deprecated
things (e.g. DroidGap)
Update unit tests to not use most deprecated things (e.g. DroidGap)
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/d8a19b55
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/d8a19b55
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/d8a19b55
Branch: refs/heads/master
Commit: d8a19b5565469ded7edaec679e7244be5b2ce743
Parents: 1c5b5e2
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Jul 10 10:23:44 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Jul 10 10:23:44 2014 -0400
----------------------------------------------------------------------
test/AndroidManifest.xml | 2 +-
.../apache/cordova/test/CordovaActivity.java | 33 ---------
.../test/CordovaWebViewTestActivity.java | 8 ++-
.../apache/cordova/test/MainTestActivity.java | 32 +++++++++
.../cordova/test/backbuttonmultipage.java | 2 +-
.../src/org/apache/cordova/test/background.java | 4 +-
.../apache/cordova/test/backgroundcolor.java | 7 +-
test/src/org/apache/cordova/test/errorurl.java | 5 +-
.../src/org/apache/cordova/test/fullscreen.java | 4 +-
.../org/apache/cordova/test/htmlnotfound.java | 2 +-
test/src/org/apache/cordova/test/iframe.java | 2 +-
.../test/junit/BackButtonMultiPageTest.java | 2 -
.../cordova/test/junit/CordovaActivityTest.java | 34 ++-------
.../cordova/test/junit/GapClientTest.java | 68 ------------------
.../cordova/test/junit/UserWebViewTest.java | 76 --------------------
test/src/org/apache/cordova/test/lifecycle.java | 2 +-
test/src/org/apache/cordova/test/loading.java | 4 +-
.../org/apache/cordova/test/splashscreen.java | 6 +-
test/src/org/apache/cordova/test/tests.java | 2 +-
test/src/org/apache/cordova/test/timeout.java | 4 +-
.../org/apache/cordova/test/userwebview.java | 19 ++---
test/src/org/apache/cordova/test/whitelist.java | 9 +--
test/src/org/apache/cordova/test/xhr.java | 2 +-
23 files changed, 77 insertions(+), 252 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/test/AndroidManifest.xml b/test/AndroidManifest.xml
index 0224702..6dec1ae 100755
--- a/test/AndroidManifest.xml
+++ b/test/AndroidManifest.xml
@@ -99,7 +99,7 @@
android:windowSoftInputMode="adjustPan"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
- android:name="org.apache.cordova.test.CordovaActivity" >
+ android:name="org.apache.cordova.test.MainTestActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/CordovaActivity.java b/test/src/org/apache/cordova/test/CordovaActivity.java
deleted file mode 100644
index f3a7839..0000000
--- a/test/src/org/apache/cordova/test/CordovaActivity.java
+++ /dev/null
@@ -1,33 +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.DroidGap;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class CordovaActivity extends DroidGap {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- super.loadUrl("file:///android_asset/www/index.html");
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java b/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java
index 7ac2c3c..e35b6e7 100644
--- a/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java
+++ b/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java
@@ -22,13 +22,13 @@ package org.apache.cordova.test;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import org.apache.cordova.Config;
+import org.apache.cordova.CordovaChromeClient;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.LOG;
+import org.apache.cordova.CordovaWebViewClient;
import org.apache.cordova.test.R;
-import org.apache.cordova.test.R.id;
-import org.apache.cordova.test.R.layout;
import android.app.Activity;
import android.content.Context;
@@ -48,6 +48,8 @@ public class CordovaWebViewTestActivity extends Activity implements CordovaInter
setContentView(R.layout.main);
cordovaWebView = (CordovaWebView) findViewById(R.id.cordovaWebView);
+ cordovaWebView.init(this, new CordovaWebViewClient(this, cordovaWebView), new CordovaChromeClient(this, cordovaWebView),
+ Config.getPluginEntries(), Config.getWhitelist(), Config.getPreferences());
cordovaWebView.loadUrl("file:///android_asset/www/index.html");
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/MainTestActivity.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/MainTestActivity.java b/test/src/org/apache/cordova/test/MainTestActivity.java
new file mode 100644
index 0000000..2a0f67e
--- /dev/null
+++ b/test/src/org/apache/cordova/test/MainTestActivity.java
@@ -0,0 +1,32 @@
+/*
+ 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.CordovaActivity;
+
+import android.os.Bundle;
+
+public class MainTestActivity extends CordovaActivity {
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.loadUrl("file:///android_asset/www/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/backbuttonmultipage.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/backbuttonmultipage.java b/test/src/org/apache/cordova/test/backbuttonmultipage.java
index 149501c..d744198 100755
--- a/test/src/org/apache/cordova/test/backbuttonmultipage.java
+++ b/test/src/org/apache/cordova/test/backbuttonmultipage.java
@@ -21,7 +21,7 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class backbuttonmultipage extends DroidGap {
+public class backbuttonmultipage extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/background.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/background.java b/test/src/org/apache/cordova/test/background.java
index 7a0ba89..d7ed101 100755
--- a/test/src/org/apache/cordova/test/background.java
+++ b/test/src/org/apache/cordova/test/background.java
@@ -22,12 +22,12 @@ import android.os.Bundle;
import org.apache.cordova.*;
-public class background extends DroidGap {
+public class background extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//super.init(new FixWebView(this), new CordovaWebViewClient(this), new CordovaChromeClient(this));
- super.setBooleanProperty("keepRunning", false);
+ preferences.set("keepRunning", false);
super.loadUrl("file:///android_asset/www/background/index.html");
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/backgroundcolor.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/backgroundcolor.java b/test/src/org/apache/cordova/test/backgroundcolor.java
index f40a673..30e297f 100755
--- a/test/src/org/apache/cordova/test/backgroundcolor.java
+++ b/test/src/org/apache/cordova/test/backgroundcolor.java
@@ -22,18 +22,15 @@ import android.graphics.Color;
import android.os.Bundle;
import org.apache.cordova.*;
-public class backgroundcolor extends DroidGap {
+public class backgroundcolor extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // Properties must be set before init() is called, since some are processed during init().
-
// backgroundColor can also be set in cordova.xml, but you must use the number equivalent of the color. For example, Color.RED is
// <preference name="backgroundColor" value="-65536" />
- super.setIntegerProperty("backgroundColor", Color.GREEN);
+ preferences.set("backgroundColor", Color.GREEN);
- super.init();
super.loadUrl("file:///android_asset/www/backgroundcolor/index.html");
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/errorurl.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/errorurl.java b/test/src/org/apache/cordova/test/errorurl.java
index 48e6ada..e946e40 100755
--- a/test/src/org/apache/cordova/test/errorurl.java
+++ b/test/src/org/apache/cordova/test/errorurl.java
@@ -21,12 +21,11 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class errorurl extends DroidGap {
+public class errorurl extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- super.init();
- this.setStringProperty("errorUrl", "file:///android_asset/www/htmlnotfound/error.html");
+ preferences.set("errorUrl", "file:///android_asset/www/htmlnotfound/error.html");
super.loadUrl("file:///android_asset/www/htmlnotfound/index.html");
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/fullscreen.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/fullscreen.java b/test/src/org/apache/cordova/test/fullscreen.java
index 7fcd79b..0aa1ee9 100755
--- a/test/src/org/apache/cordova/test/fullscreen.java
+++ b/test/src/org/apache/cordova/test/fullscreen.java
@@ -21,7 +21,7 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class fullscreen extends DroidGap {
+public class fullscreen extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -30,7 +30,7 @@ public class fullscreen extends DroidGap {
// fullscreen can also be set in cordova.xml. For example,
// <preference name="fullscreen" value="true" />
- super.setBooleanProperty("fullscreen", true);
+ preferences.set("fullscreen", true);
super.init();
super.loadUrl("file:///android_asset/www/fullscreen/index.html");
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/htmlnotfound.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/htmlnotfound.java b/test/src/org/apache/cordova/test/htmlnotfound.java
index 4551ca3..c602922 100755
--- a/test/src/org/apache/cordova/test/htmlnotfound.java
+++ b/test/src/org/apache/cordova/test/htmlnotfound.java
@@ -21,7 +21,7 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class htmlnotfound extends DroidGap {
+public class htmlnotfound extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/iframe.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/iframe.java b/test/src/org/apache/cordova/test/iframe.java
index de854fc..3d30cfb 100755
--- a/test/src/org/apache/cordova/test/iframe.java
+++ b/test/src/org/apache/cordova/test/iframe.java
@@ -21,7 +21,7 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class iframe extends DroidGap {
+public class iframe extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java b/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java
index 007069f..ee95e43 100644
--- a/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java
+++ b/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java
@@ -85,9 +85,7 @@ public class BackButtonMultiPageTest extends ActivityInstrumentationTestCase2<ba
{
String url = testView.getUrl();
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", url);
- testView.printBackForwardList();
assertTrue(testView.backHistory());
- testView.printBackForwardList();
}
});
sleep();
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/junit/CordovaActivityTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/CordovaActivityTest.java b/test/src/org/apache/cordova/test/junit/CordovaActivityTest.java
index f9d70b2..883a0f7 100644
--- a/test/src/org/apache/cordova/test/junit/CordovaActivityTest.java
+++ b/test/src/org/apache/cordova/test/junit/CordovaActivityTest.java
@@ -21,16 +21,16 @@ package org.apache.cordova.test.junit;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginManager;
-import org.apache.cordova.test.CordovaActivity;
+import org.apache.cordova.test.MainTestActivity;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
-public class CordovaActivityTest extends ActivityInstrumentationTestCase2<CordovaActivity> {
+public class CordovaActivityTest extends ActivityInstrumentationTestCase2<MainTestActivity> {
- private CordovaActivity testActivity;
+ private MainTestActivity testActivity;
private FrameLayout containerView;
private LinearLayout innerContainer;
private CordovaWebView testView;
@@ -40,7 +40,7 @@ public class CordovaActivityTest extends ActivityInstrumentationTestCase2<Cordov
@SuppressWarnings("deprecation")
public CordovaActivityTest()
{
- super("org.apache.cordova.test",CordovaActivity.class);
+ super("org.apache.cordova.test",MainTestActivity.class);
}
protected void setUp() throws Exception {
@@ -68,33 +68,7 @@ public class CordovaActivityTest extends ActivityInstrumentationTestCase2<Cordov
String className = innerContainer.getClass().getSimpleName();
assertTrue(className.equals("LinearLayoutSoftKeyboardDetect"));
}
-
- public void testPauseAndResume() throws Throwable
- {
- runTestOnUiThread(new Runnable() {
- public void run()
- {
- mInstr.callActivityOnPause(testActivity);
- }
- });
- sleep();
- runTestOnUiThread(new Runnable() {
- public void run()
- {
- assertTrue(testView.isPaused());
- mInstr.callActivityOnResume(testActivity);
- }
- });
- sleep();
- runTestOnUiThread(new Runnable() {
- public void run()
- {
- assertFalse(testView.isPaused());
- }
- });
- }
-
private void sleep() {
try {
Thread.sleep(TIMEOUT);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/junit/GapClientTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/GapClientTest.java b/test/src/org/apache/cordova/test/junit/GapClientTest.java
deleted file mode 100644
index 4540d92..0000000
--- a/test/src/org/apache/cordova/test/junit/GapClientTest.java
+++ /dev/null
@@ -1,68 +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.junit;
-
-import org.apache.cordova.CordovaWebView;
-import org.apache.cordova.CordovaChromeClient;
-import org.apache.cordova.PluginManager;
-import org.apache.cordova.test.CordovaWebViewTestActivity;
-
-import android.content.Context;
-import android.content.res.AssetManager;
-import android.content.res.Resources;
-import android.test.ActivityInstrumentationTestCase2;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-
-public class GapClientTest extends ActivityInstrumentationTestCase2<CordovaWebViewTestActivity> {
-
- private CordovaWebViewTestActivity testActivity;
- private FrameLayout containerView;
- private LinearLayout innerContainer;
- private View testView;
- private String rString;
- private CordovaChromeClient appCode;
-
- public GapClientTest() {
- super("org.apache.cordova.test.activities",CordovaWebViewTestActivity.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 = innerContainer.getChildAt(0);
-
- }
-
- public void testPreconditions(){
- assertNotNull(innerContainer);
- assertNotNull(testView);
- }
-
- public void testForCordovaView() {
- String className = testView.getClass().getSimpleName();
- assertTrue(className.equals("CordovaWebView"));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/junit/UserWebViewTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/UserWebViewTest.java b/test/src/org/apache/cordova/test/junit/UserWebViewTest.java
deleted file mode 100644
index 62dcbe0..0000000
--- a/test/src/org/apache/cordova/test/junit/UserWebViewTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.apache.cordova.test.junit;
-/*
- *
- * 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.
- *
-*/
-
-
-import org.apache.cordova.CordovaWebView;
-import org.apache.cordova.CordovaWebViewClient;
-import org.apache.cordova.CordovaChromeClient;
-import org.apache.cordova.test.userwebview;
-
-import android.test.ActivityInstrumentationTestCase2;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-
-public class UserWebViewTest extends ActivityInstrumentationTestCase2<userwebview> {
-
- public UserWebViewTest ()
- {
- super(userwebview.class);
- }
-
- private int TIMEOUT = 1000;
- userwebview testActivity;
- private FrameLayout containerView;
- private LinearLayout innerContainer;
- private CordovaWebView testView;
-
-
- 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 testCustom()
- {
- assertTrue(CordovaWebView.class.isInstance(testView));
- assertTrue(CordovaWebViewClient.class.isInstance(testActivity.testViewClient));
- assertTrue(CordovaChromeClient.class.isInstance(testActivity.testChromeClient));
- }
-
-
- private void sleep() {
- try {
- Thread.sleep(TIMEOUT);
- } catch (InterruptedException e) {
- fail("Unexpected Timeout");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/lifecycle.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/lifecycle.java b/test/src/org/apache/cordova/test/lifecycle.java
index 30c5b8b..d1c4212 100755
--- a/test/src/org/apache/cordova/test/lifecycle.java
+++ b/test/src/org/apache/cordova/test/lifecycle.java
@@ -21,7 +21,7 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class lifecycle extends DroidGap {
+public class lifecycle extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/loading.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/loading.java b/test/src/org/apache/cordova/test/loading.java
index b1b08ae..da2c4ff 100755
--- a/test/src/org/apache/cordova/test/loading.java
+++ b/test/src/org/apache/cordova/test/loading.java
@@ -21,11 +21,11 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class loading extends DroidGap {
+public class loading extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- super.setStringProperty("loadingDialog", "Testing,Loading...");
+ preferences.set("loadingDialog", "Testing,Loading...");
super.loadUrl("http://www.google.com");
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/splashscreen.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/splashscreen.java b/test/src/org/apache/cordova/test/splashscreen.java
index ef49d73..50a94a9 100755
--- a/test/src/org/apache/cordova/test/splashscreen.java
+++ b/test/src/org/apache/cordova/test/splashscreen.java
@@ -20,17 +20,15 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-import org.apache.cordova.test.R;
-import org.apache.cordova.test.R.drawable;
-public class splashscreen extends DroidGap {
+public class splashscreen extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
// Show splashscreen
- this.setIntegerProperty("splashscreen", R.drawable.sandy);
+ preferences.set("splashscreen", "sandy");
super.loadUrl("file:///android_asset/www/splashscreen/index.html", 2000);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/tests.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/tests.java b/test/src/org/apache/cordova/test/tests.java
index 80c7f24..64ad56e 100755
--- a/test/src/org/apache/cordova/test/tests.java
+++ b/test/src/org/apache/cordova/test/tests.java
@@ -21,7 +21,7 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class tests extends DroidGap {
+public class tests extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/timeout.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/timeout.java b/test/src/org/apache/cordova/test/timeout.java
index 31edb8d..8a418a3 100755
--- a/test/src/org/apache/cordova/test/timeout.java
+++ b/test/src/org/apache/cordova/test/timeout.java
@@ -21,14 +21,14 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class timeout extends DroidGap {
+public class timeout extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
// Short timeout to cause error
- this.setIntegerProperty("loadUrlTimeoutValue", 10);
+ preferences.set("loadUrlTimeoutValue", 10);
super.loadUrl("http://www.google.com");
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/userwebview.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/userwebview.java b/test/src/org/apache/cordova/test/userwebview.java
index 6146a40..3481dc7 100755
--- a/test/src/org/apache/cordova/test/userwebview.java
+++ b/test/src/org/apache/cordova/test/userwebview.java
@@ -23,9 +23,8 @@ import android.webkit.WebView;
import android.webkit.GeolocationPermissions.Callback;
import org.apache.cordova.*;
-import org.apache.cordova.LOG;
-public class userwebview extends DroidGap {
+public class userwebview extends MainTestActivity {
public TestViewClient testViewClient;
public TestChromeClient testChromeClient;
@@ -33,15 +32,17 @@ public class userwebview extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- testViewClient = new TestViewClient(this);
- testChromeClient = new TestChromeClient(this);
- super.init(new CordovaWebView(this), new TestViewClient(this), new TestChromeClient(this));
+ testViewClient = new TestViewClient(this, appView);
+ testChromeClient = new TestChromeClient(this, appView);
+ super.init();
+ appView.setWebViewClient(testViewClient);
+ appView.setWebChromeClient(testChromeClient);
super.loadUrl("file:///android_asset/www/userwebview/index.html");
}
public class TestChromeClient extends CordovaChromeClient {
- public TestChromeClient(DroidGap arg0) {
- super(arg0);
+ public TestChromeClient(CordovaInterface ctx, CordovaWebView app) {
+ super(ctx, app);
LOG.d("userwebview", "TestChromeClient()");
}
@@ -57,8 +58,8 @@ public class userwebview extends DroidGap {
* This class can be used to override the GapViewClient and receive notification of webview events.
*/
public class TestViewClient extends CordovaWebViewClient {
- public TestViewClient(DroidGap arg0) {
- super(arg0);
+ public TestViewClient(CordovaInterface ctx, CordovaWebView app) {
+ super(ctx, app);
LOG.d("userwebview", "TestViewClient()");
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/whitelist.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/whitelist.java b/test/src/org/apache/cordova/test/whitelist.java
index 26eebf3..c949893 100755
--- a/test/src/org/apache/cordova/test/whitelist.java
+++ b/test/src/org/apache/cordova/test/whitelist.java
@@ -24,11 +24,12 @@ import android.webkit.WebView;
import org.apache.cordova.*;
import org.apache.cordova.LOG;
-public class whitelist extends DroidGap {
+public class whitelist extends MainTestActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- super.init(new CordovaWebView(this), new TestViewClient(this), new CordovaChromeClient(this));
+ super.init();
+ appView.setWebViewClient(new TestViewClient(this, appView));
super.loadUrl("file:///android_asset/www/whitelist/index.html");
}
@@ -37,8 +38,8 @@ public class whitelist extends DroidGap {
*/
public class TestViewClient extends CordovaWebViewClient {
- public TestViewClient(DroidGap arg0) {
- super(arg0);
+ public TestViewClient(CordovaInterface ctx, CordovaWebView app) {
+ super(ctx, app);
}
@Override
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8a19b55/test/src/org/apache/cordova/test/xhr.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/xhr.java b/test/src/org/apache/cordova/test/xhr.java
index 402e0ad..4f73926 100755
--- a/test/src/org/apache/cordova/test/xhr.java
+++ b/test/src/org/apache/cordova/test/xhr.java
@@ -21,7 +21,7 @@ package org.apache.cordova.test;
import android.os.Bundle;
import org.apache.cordova.*;
-public class xhr extends DroidGap {
+public class xhr extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);