From 792aa78aecb1d4a73033ae970cb44cd9b325db39 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Thu, 11 Jul 2013 15:04:24 -0700 Subject: [PATCH] Updating imports on all the tests --- .../apache/cordova/test/ActivityPlugin.java | 8 +- .../apache/cordova/test/BlacklistTest.java | 87 +++++++++++++++++++ .../cordova/test/CordovaActivityTest.java | 2 +- .../org/apache/cordova/test/CordovaTest.java | 2 +- .../apache/cordova/test/GapClientTest.java | 2 +- .../src/org/apache/cordova/test/MenuTest.java | 32 +++++++ .../cordova/test/PluginManagerTest.java | 2 +- .../apache/cordova/test/UriResolversTest.java | 6 +- .../test/actions/CordovaDriverAction.java | 4 +- .../actions/CordovaWebViewTestActivity.java | 6 +- .../apache/cordova/test/actions/menus.java | 2 +- .../cordova/test/actions/userwebview.java | 2 +- .../cordova/test/actions/whitelist.java | 2 +- 13 files changed, 138 insertions(+), 19 deletions(-) create mode 100644 test/src/org/apache/cordova/test/BlacklistTest.java create mode 100644 test/src/org/apache/cordova/test/MenuTest.java diff --git a/test/src/org/apache/cordova/test/ActivityPlugin.java b/test/src/org/apache/cordova/test/ActivityPlugin.java index 0c1d1da9..19a50a2b 100755 --- a/test/src/org/apache/cordova/test/ActivityPlugin.java +++ b/test/src/org/apache/cordova/test/ActivityPlugin.java @@ -19,15 +19,15 @@ package org.apache.cordova.test; import org.apache.cordova.CordovaArgs; -import org.apache.cordova.api.LOG; +import org.apache.cordova.LOG; import org.json.JSONArray; import org.json.JSONException; import android.content.Intent; -import org.apache.cordova.api.CallbackContext; -import org.apache.cordova.api.CordovaPlugin; -import org.apache.cordova.api.PluginResult; +import org.apache.cordova.CallbackContext; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.PluginResult; /** * This class provides a service. diff --git a/test/src/org/apache/cordova/test/BlacklistTest.java b/test/src/org/apache/cordova/test/BlacklistTest.java new file mode 100644 index 00000000..d71e84c8 --- /dev/null +++ b/test/src/org/apache/cordova/test/BlacklistTest.java @@ -0,0 +1,87 @@ +/* + 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 org.apache.cordova.test.actions.CordovaActivity; +import org.apache.cordova.test.actions.backbuttonmultipage; + +import android.app.Instrumentation; +import android.test.ActivityInstrumentationTestCase2; +import android.widget.FrameLayout; +import android.widget.LinearLayout; + +public class BlacklistTest extends ActivityInstrumentationTestCase2 { + + private int TIMEOUT = 1000; + private Instrumentation mInstr; + private CordovaActivity testActivity; + private FrameLayout containerView; + private LinearLayout innerContainer; + private CordovaWebView testView; + + public BlacklistTest() + { + super("org.apache.cordova.test", CordovaActivity.class); + } + + public BlacklistTest(Class activityClass) { + super(activityClass); + } + + + protected void setUp() throws Exception { + super.setUp(); + mInstr = this.getInstrumentation(); + 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 testWhitelist(){ + testView.loadUrl("http://cordova.apache.org"); + sleep(); + String url = testView.getUrl(); + assertTrue(url.equals("http://cordova.apache.org")); + } + + public void testBlacklist() + { + testView.loadUrl("http://phonegap.com"); + sleep(); + String url = testView.getUrl(); + assertTrue(url.equals("http://phonegap.com")); + } + + private void sleep() { + try { + Thread.sleep(TIMEOUT); + } catch (InterruptedException e) { + fail("Unexpected Timeout"); + } + } +} diff --git a/test/src/org/apache/cordova/test/CordovaActivityTest.java b/test/src/org/apache/cordova/test/CordovaActivityTest.java index efb80c19..a100f0a0 100644 --- a/test/src/org/apache/cordova/test/CordovaActivityTest.java +++ b/test/src/org/apache/cordova/test/CordovaActivityTest.java @@ -20,7 +20,7 @@ package org.apache.cordova.test; import org.apache.cordova.CordovaWebView; -import org.apache.cordova.api.PluginManager; +import org.apache.cordova.PluginManager; import org.apache.cordova.test.actions.CordovaActivity; import android.app.Instrumentation; diff --git a/test/src/org/apache/cordova/test/CordovaTest.java b/test/src/org/apache/cordova/test/CordovaTest.java index 8dd409c6..0e11b684 100644 --- a/test/src/org/apache/cordova/test/CordovaTest.java +++ b/test/src/org/apache/cordova/test/CordovaTest.java @@ -19,7 +19,7 @@ package org.apache.cordova.test; import org.apache.cordova.CordovaWebView; -import org.apache.cordova.api.PluginManager; +import org.apache.cordova.PluginManager; import org.apache.cordova.test.actions.CordovaWebViewTestActivity; import android.app.Instrumentation; diff --git a/test/src/org/apache/cordova/test/GapClientTest.java b/test/src/org/apache/cordova/test/GapClientTest.java index b9b113b4..a3c2a624 100644 --- a/test/src/org/apache/cordova/test/GapClientTest.java +++ b/test/src/org/apache/cordova/test/GapClientTest.java @@ -21,7 +21,7 @@ package org.apache.cordova.test; import org.apache.cordova.CordovaWebView; import org.apache.cordova.CordovaChromeClient; -import org.apache.cordova.api.PluginManager; +import org.apache.cordova.PluginManager; import org.apache.cordova.test.actions.CordovaWebViewTestActivity; import android.content.Context; diff --git a/test/src/org/apache/cordova/test/MenuTest.java b/test/src/org/apache/cordova/test/MenuTest.java new file mode 100644 index 00000000..1486ccab --- /dev/null +++ b/test/src/org/apache/cordova/test/MenuTest.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.test.actions.menus; + +import android.test.ActivityInstrumentationTestCase2; + +public class MenuTest extends ActivityInstrumentationTestCase2 { + + public MenuTest() { + super("org.apache.cordova.test", menus.class); + } + +} diff --git a/test/src/org/apache/cordova/test/PluginManagerTest.java b/test/src/org/apache/cordova/test/PluginManagerTest.java index d322e6c5..c767e7d7 100644 --- a/test/src/org/apache/cordova/test/PluginManagerTest.java +++ b/test/src/org/apache/cordova/test/PluginManagerTest.java @@ -20,7 +20,7 @@ package org.apache.cordova.test; import org.apache.cordova.CordovaWebView; -import org.apache.cordova.api.PluginManager; +import org.apache.cordova.PluginManager; import org.apache.cordova.test.actions.CordovaWebViewTestActivity; import android.test.ActivityInstrumentationTestCase2; diff --git a/test/src/org/apache/cordova/test/UriResolversTest.java b/test/src/org/apache/cordova/test/UriResolversTest.java index 21584b9e..bf2fd634 100644 --- a/test/src/org/apache/cordova/test/UriResolversTest.java +++ b/test/src/org/apache/cordova/test/UriResolversTest.java @@ -25,9 +25,9 @@ package org.apache.cordova.test; import org.apache.cordova.CordovaWebView; import org.apache.cordova.UriResolver; import org.apache.cordova.UriResolvers; -import org.apache.cordova.api.CallbackContext; -import org.apache.cordova.api.CordovaPlugin; -import org.apache.cordova.api.PluginEntry; +import org.apache.cordova.CallbackContext; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.PluginEntry; import org.apache.cordova.test.actions.CordovaWebViewTestActivity; import org.json.JSONArray; import org.json.JSONException; diff --git a/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java b/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java index e6156ec1..2e5d7409 100644 --- a/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java +++ b/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java @@ -21,8 +21,8 @@ package org.apache.cordova.test.actions; import java.util.concurrent.ExecutorService; -import org.apache.cordova.api.CordovaInterface; -import org.apache.cordova.api.CordovaPlugin; +import org.apache.cordova.CordovaInterface; +import org.apache.cordova.CordovaPlugin; import android.app.Activity; import android.content.Context; diff --git a/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java b/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java index 3be5ab21..02d4b8db 100644 --- a/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java +++ b/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java @@ -23,9 +23,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.apache.cordova.CordovaWebView; -import org.apache.cordova.api.CordovaInterface; -import org.apache.cordova.api.CordovaPlugin; -import org.apache.cordova.api.LOG; +import org.apache.cordova.CordovaInterface; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.LOG; import org.apache.cordova.test.R; import org.apache.cordova.test.R.id; import org.apache.cordova.test.R.layout; diff --git a/test/src/org/apache/cordova/test/actions/menus.java b/test/src/org/apache/cordova/test/actions/menus.java index e567905e..c4cb6745 100755 --- a/test/src/org/apache/cordova/test/actions/menus.java +++ b/test/src/org/apache/cordova/test/actions/menus.java @@ -26,7 +26,7 @@ import android.view.View; import android.view.ContextMenu.ContextMenuInfo; import org.apache.cordova.*; -import org.apache.cordova.api.LOG; +import org.apache.cordova.LOG; public class menus extends DroidGap { @Override diff --git a/test/src/org/apache/cordova/test/actions/userwebview.java b/test/src/org/apache/cordova/test/actions/userwebview.java index 84320f47..305a2e9a 100755 --- a/test/src/org/apache/cordova/test/actions/userwebview.java +++ b/test/src/org/apache/cordova/test/actions/userwebview.java @@ -23,7 +23,7 @@ import android.webkit.WebView; import android.webkit.GeolocationPermissions.Callback; import org.apache.cordova.*; -import org.apache.cordova.api.LOG; +import org.apache.cordova.LOG; public class userwebview extends DroidGap { diff --git a/test/src/org/apache/cordova/test/actions/whitelist.java b/test/src/org/apache/cordova/test/actions/whitelist.java index 57a07233..7d5a51aa 100755 --- a/test/src/org/apache/cordova/test/actions/whitelist.java +++ b/test/src/org/apache/cordova/test/actions/whitelist.java @@ -22,7 +22,7 @@ import android.os.Bundle; import android.webkit.WebView; import org.apache.cordova.*; -import org.apache.cordova.api.LOG; +import org.apache.cordova.LOG; public class whitelist extends DroidGap { @Override