mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 08:53:24 +08:00
Merge branch 'master' into 4.0.x (Unbreak unit tests)
Conflicts: test/src/org/apache/cordova/test/junit/GapClientTest.java test/src/org/apache/cordova/test/userwebview.java test/src/org/apache/cordova/test/whitelist.java
This commit is contained in:
commit
f38c460588
@ -40,6 +40,18 @@ public class CordovaPreferences {
|
|||||||
prefs.put(name.toLowerCase(Locale.ENGLISH), value);
|
prefs.put(name.toLowerCase(Locale.ENGLISH), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void set(String name, boolean value) {
|
||||||
|
set(name, "" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(String name, int value) {
|
||||||
|
set(name, "" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(String name, double value) {
|
||||||
|
set(name, "" + value);
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, String> getAll() {
|
public Map<String, String> getAll() {
|
||||||
return prefs;
|
return prefs;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
android:windowSoftInputMode="adjustPan"
|
android:windowSoftInputMode="adjustPan"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:name="org.apache.cordova.test.CordovaActivity" >
|
android:name="org.apache.cordova.test.MainTestActivity" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||||
|
@ -22,13 +22,11 @@ package org.apache.cordova.test;
|
|||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import org.apache.cordova.Config;
|
||||||
import org.apache.cordova.CordovaWebView;
|
import org.apache.cordova.CordovaWebView;
|
||||||
import org.apache.cordova.CordovaInterface;
|
import org.apache.cordova.CordovaInterface;
|
||||||
import org.apache.cordova.CordovaPlugin;
|
import org.apache.cordova.CordovaPlugin;
|
||||||
import org.apache.cordova.LOG;
|
|
||||||
import org.apache.cordova.test.R;
|
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.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -48,6 +46,8 @@ public class CordovaWebViewTestActivity extends Activity implements CordovaInter
|
|||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
|
|
||||||
cordovaWebView = (CordovaWebView) findViewById(R.id.cordovaWebView);
|
cordovaWebView = (CordovaWebView) findViewById(R.id.cordovaWebView);
|
||||||
|
cordovaWebView.init(this,
|
||||||
|
Config.getPluginEntries(), Config.getWhitelist(), Config.getPreferences());
|
||||||
|
|
||||||
cordovaWebView.loadUrl("file:///android_asset/www/index.html");
|
cordovaWebView.loadUrl("file:///android_asset/www/index.html");
|
||||||
|
|
||||||
|
@ -18,12 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.cordova.test;
|
package org.apache.cordova.test;
|
||||||
|
|
||||||
import org.apache.cordova.DroidGap;
|
import org.apache.cordova.CordovaActivity;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
public class CordovaActivity extends DroidGap {
|
public class MainTestActivity extends CordovaActivity {
|
||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
@ -21,7 +21,7 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class backbuttonmultipage extends DroidGap {
|
public class backbuttonmultipage extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -22,12 +22,12 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class background extends DroidGap {
|
public class background extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
//super.init(new FixWebView(this), new CordovaWebViewClient(this), new CordovaChromeClient(this));
|
//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");
|
super.loadUrl("file:///android_asset/www/background/index.html");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,18 +22,15 @@ import android.graphics.Color;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class backgroundcolor extends DroidGap {
|
public class backgroundcolor extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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
|
// 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" />
|
// <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");
|
super.loadUrl("file:///android_asset/www/backgroundcolor/index.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,12 +21,11 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class errorurl extends DroidGap {
|
public class errorurl extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
super.init();
|
preferences.set("errorUrl", "file:///android_asset/www/htmlnotfound/error.html");
|
||||||
this.setStringProperty("errorUrl", "file:///android_asset/www/htmlnotfound/error.html");
|
|
||||||
super.loadUrl("file:///android_asset/www/htmlnotfound/index.html");
|
super.loadUrl("file:///android_asset/www/htmlnotfound/index.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class fullscreen extends DroidGap {
|
public class fullscreen extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -30,7 +30,7 @@ public class fullscreen extends DroidGap {
|
|||||||
|
|
||||||
// fullscreen can also be set in cordova.xml. For example,
|
// fullscreen can also be set in cordova.xml. For example,
|
||||||
// <preference name="fullscreen" value="true" />
|
// <preference name="fullscreen" value="true" />
|
||||||
super.setBooleanProperty("fullscreen", true);
|
preferences.set("fullscreen", true);
|
||||||
|
|
||||||
super.init();
|
super.init();
|
||||||
super.loadUrl("file:///android_asset/www/fullscreen/index.html");
|
super.loadUrl("file:///android_asset/www/fullscreen/index.html");
|
||||||
|
@ -21,7 +21,7 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class htmlnotfound extends DroidGap {
|
public class htmlnotfound extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -21,7 +21,7 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class iframe extends DroidGap {
|
public class iframe extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -86,9 +86,7 @@ public class BackButtonMultiPageTest extends ActivityInstrumentationTestCase2<ba
|
|||||||
{
|
{
|
||||||
String url = testView.getUrl();
|
String url = testView.getUrl();
|
||||||
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", url);
|
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", url);
|
||||||
testView.printBackForwardList();
|
|
||||||
assertTrue(testView.backHistory());
|
assertTrue(testView.backHistory());
|
||||||
testView.printBackForwardList();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sleep();
|
sleep();
|
||||||
|
@ -21,16 +21,16 @@ package org.apache.cordova.test.junit;
|
|||||||
|
|
||||||
import org.apache.cordova.CordovaWebView;
|
import org.apache.cordova.CordovaWebView;
|
||||||
import org.apache.cordova.PluginManager;
|
import org.apache.cordova.PluginManager;
|
||||||
import org.apache.cordova.test.CordovaActivity;
|
import org.apache.cordova.test.MainTestActivity;
|
||||||
|
|
||||||
import android.app.Instrumentation;
|
import android.app.Instrumentation;
|
||||||
import android.test.ActivityInstrumentationTestCase2;
|
import android.test.ActivityInstrumentationTestCase2;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.LinearLayout;
|
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 FrameLayout containerView;
|
||||||
private LinearLayout innerContainer;
|
private LinearLayout innerContainer;
|
||||||
private CordovaWebView testView;
|
private CordovaWebView testView;
|
||||||
@ -40,7 +40,7 @@ public class CordovaActivityTest extends ActivityInstrumentationTestCase2<Cordov
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public CordovaActivityTest()
|
public CordovaActivityTest()
|
||||||
{
|
{
|
||||||
super("org.apache.cordova.test",CordovaActivity.class);
|
super("org.apache.cordova.test",MainTestActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
@ -68,33 +68,7 @@ public class CordovaActivityTest extends ActivityInstrumentationTestCase2<Cordov
|
|||||||
String className = innerContainer.getClass().getSimpleName();
|
String className = innerContainer.getClass().getSimpleName();
|
||||||
assertTrue(className.equals("LinearLayoutSoftKeyboardDetect"));
|
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() {
|
private void sleep() {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(TIMEOUT);
|
Thread.sleep(TIMEOUT);
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package org.apache.cordova.test.junit;
|
package org.apache.cordova.test.junit;
|
||||||
|
|
||||||
import org.apache.cordova.CordovaWebView;
|
import org.apache.cordova.CordovaWebView;
|
||||||
import org.apache.cordova.CordovaChromeClient;
|
|
||||||
import org.apache.cordova.PluginManager;
|
import org.apache.cordova.PluginManager;
|
||||||
import org.apache.cordova.test.CordovaWebViewTestActivity;
|
import org.apache.cordova.test.CordovaWebViewTestActivity;
|
||||||
|
|
||||||
@ -39,7 +38,6 @@ public class GapClientTest extends ActivityInstrumentationTestCase2<CordovaWebVi
|
|||||||
private LinearLayout innerContainer;
|
private LinearLayout innerContainer;
|
||||||
private View testView;
|
private View testView;
|
||||||
private String rString;
|
private String rString;
|
||||||
private CordovaChromeClient appCode;
|
|
||||||
|
|
||||||
public GapClientTest() {
|
public GapClientTest() {
|
||||||
super("org.apache.cordova.test.activities",CordovaWebViewTestActivity.class);
|
super("org.apache.cordova.test.activities",CordovaWebViewTestActivity.class);
|
||||||
|
@ -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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -21,7 +21,7 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class lifecycle extends DroidGap {
|
public class lifecycle extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -21,11 +21,11 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class loading extends DroidGap {
|
public class loading extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
super.setStringProperty("loadingDialog", "Testing,Loading...");
|
preferences.set("loadingDialog", "Testing,Loading...");
|
||||||
super.loadUrl("http://www.google.com");
|
super.loadUrl("http://www.google.com");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,17 +20,15 @@ package org.apache.cordova.test;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
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
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
// Show splashscreen
|
// Show splashscreen
|
||||||
this.setIntegerProperty("splashscreen", R.drawable.sandy);
|
preferences.set("splashscreen", "sandy");
|
||||||
|
|
||||||
super.loadUrl("file:///android_asset/www/splashscreen/index.html", 2000);
|
super.loadUrl("file:///android_asset/www/splashscreen/index.html", 2000);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class tests extends DroidGap {
|
public class tests extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -21,14 +21,14 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class timeout extends DroidGap {
|
public class timeout extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
// Short timeout to cause error
|
// Short timeout to cause error
|
||||||
this.setIntegerProperty("loadUrlTimeoutValue", 10);
|
preferences.set("loadUrlTimeoutValue", 10);
|
||||||
super.loadUrl("http://www.google.com");
|
super.loadUrl("http://www.google.com");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,8 @@ import android.webkit.WebView;
|
|||||||
import android.webkit.GeolocationPermissions.Callback;
|
import android.webkit.GeolocationPermissions.Callback;
|
||||||
|
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
import org.apache.cordova.LOG;
|
|
||||||
|
|
||||||
public class userwebview extends CordovaActivity {
|
public class userwebview extends MainTestActivity {
|
||||||
|
|
||||||
public TestViewClient testViewClient;
|
public TestViewClient testViewClient;
|
||||||
public TestChromeClient testChromeClient;
|
public TestChromeClient testChromeClient;
|
||||||
@ -33,15 +32,17 @@ public class userwebview extends CordovaActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
testViewClient = new TestViewClient(this);
|
testViewClient = new TestViewClient(this, ((AndroidWebView)appView));
|
||||||
testChromeClient = new TestChromeClient(this);
|
testChromeClient = new TestChromeClient(this, ((AndroidWebView)appView));
|
||||||
super.init(new AndroidWebView(this), new TestViewClient(this), new TestChromeClient(this));
|
super.init();
|
||||||
|
((AndroidWebView)appView).setWebViewClient(testViewClient);
|
||||||
|
((AndroidWebView)appView).setWebChromeClient(testChromeClient);
|
||||||
super.loadUrl("file:///android_asset/www/userwebview/index.html");
|
super.loadUrl("file:///android_asset/www/userwebview/index.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestChromeClient extends AndroidChromeClient {
|
public class TestChromeClient extends AndroidChromeClient {
|
||||||
public TestChromeClient(CordovaActivity arg0) {
|
public TestChromeClient(CordovaInterface ctx, AndroidWebView app) {
|
||||||
super(arg0);
|
super(ctx, app);
|
||||||
LOG.d("userwebview", "TestChromeClient()");
|
LOG.d("userwebview", "TestChromeClient()");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,8 +58,8 @@ public class userwebview extends CordovaActivity {
|
|||||||
* This class can be used to override the GapViewClient and receive notification of webview events.
|
* This class can be used to override the GapViewClient and receive notification of webview events.
|
||||||
*/
|
*/
|
||||||
public class TestViewClient extends AndroidWebViewClient {
|
public class TestViewClient extends AndroidWebViewClient {
|
||||||
public TestViewClient(CordovaActivity arg0) {
|
public TestViewClient(CordovaInterface ctx, AndroidWebView app) {
|
||||||
super(arg0);
|
super(ctx, app);
|
||||||
LOG.d("userwebview", "TestViewClient()");
|
LOG.d("userwebview", "TestViewClient()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,11 +23,12 @@ import android.webkit.WebView;
|
|||||||
|
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class whitelist extends CordovaActivity {
|
public class whitelist extends MainTestActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
super.init(new AndroidWebView(this), new TestViewClient(this), new AndroidChromeClient(this));
|
super.init();
|
||||||
|
((AndroidWebView)appView).setWebViewClient(new TestViewClient(this, ((AndroidWebView)appView)));
|
||||||
super.loadUrl("file:///android_asset/www/whitelist/index.html");
|
super.loadUrl("file:///android_asset/www/whitelist/index.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,8 +37,8 @@ public class whitelist extends CordovaActivity {
|
|||||||
*/
|
*/
|
||||||
public class TestViewClient extends AndroidWebViewClient {
|
public class TestViewClient extends AndroidWebViewClient {
|
||||||
|
|
||||||
public TestViewClient(CordovaActivity arg0) {
|
public TestViewClient(CordovaInterface ctx, AndroidWebView app) {
|
||||||
super(arg0);
|
super(ctx, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,7 +21,7 @@ package org.apache.cordova.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
public class xhr extends DroidGap {
|
public class xhr extends CordovaActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
Loading…
Reference in New Issue
Block a user