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:45 UTC

[11/11] android commit: Merge branch 'master' into 4.0.x (Unbreak unit tests)

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


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/f38c4605
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/f38c4605
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/f38c4605

Branch: refs/heads/4.0.x
Commit: f38c460588f1fe1eb05077882227db68289de27b
Parents: 9b9c597 d8a19b5
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Jul 10 10:30:05 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Jul 10 10:30:05 2014 -0400

----------------------------------------------------------------------
 .../org/apache/cordova/CordovaPreferences.java  | 12 ++++
 test/AndroidManifest.xml                        |  2 +-
 .../apache/cordova/test/CordovaActivity.java    | 33 ---------
 .../test/CordovaWebViewTestActivity.java        |  6 +-
 .../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       |  2 -
 .../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 +-
 24 files changed, 87 insertions(+), 186 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f38c4605/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java
----------------------------------------------------------------------
diff --cc test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java
index 7ac2c3c,e35b6e7..a078f21
--- a/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java
+++ b/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java
@@@ -22,13 -22,13 +22,11 @@@ package org.apache.cordova.test
  import java.util.concurrent.ExecutorService;
  import java.util.concurrent.Executors;
  
+ import org.apache.cordova.Config;
  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 +46,8 @@@ public class CordovaWebViewTestActivit
          setContentView(R.layout.main);
  
          cordovaWebView = (CordovaWebView) findViewById(R.id.cordovaWebView);
 -        cordovaWebView.init(this, new CordovaWebViewClient(this, cordovaWebView), new CordovaChromeClient(this, cordovaWebView),
++        cordovaWebView.init(this,
+                 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/f38c4605/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f38c4605/test/src/org/apache/cordova/test/junit/CordovaActivityTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f38c4605/test/src/org/apache/cordova/test/junit/GapClientTest.java
----------------------------------------------------------------------
diff --cc test/src/org/apache/cordova/test/junit/GapClientTest.java
index 2203ef8,0000000..ce6ca8c
mode 100644,000000..100644
--- a/test/src/org/apache/cordova/test/junit/GapClientTest.java
+++ b/test/src/org/apache/cordova/test/junit/GapClientTest.java
@@@ -1,68 -1,0 +1,66 @@@
 +/*
 +       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 testForAndroidWebView() {
 +	    String className = testView.getClass().getSimpleName();
 +	    assertTrue(className.equals("AndroidWebView"));
 +	}
 +	
 +	
 +}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f38c4605/test/src/org/apache/cordova/test/userwebview.java
----------------------------------------------------------------------
diff --cc test/src/org/apache/cordova/test/userwebview.java
index d987911,3481dc7..4237e19
--- a/test/src/org/apache/cordova/test/userwebview.java
+++ b/test/src/org/apache/cordova/test/userwebview.java
@@@ -33,15 -32,17 +32,17 @@@ public class userwebview extends MainTe
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
-         testViewClient = new TestViewClient(this);
-         testChromeClient = new TestChromeClient(this);
-         super.init(new AndroidWebView(this), new TestViewClient(this), new TestChromeClient(this));
 -        testViewClient = new TestViewClient(this, appView);
 -        testChromeClient = new TestChromeClient(this, appView);
++        testViewClient = new TestViewClient(this, ((AndroidWebView)appView));
++        testChromeClient = new TestChromeClient(this, ((AndroidWebView)appView));
+         super.init();
 -        appView.setWebViewClient(testViewClient);
 -        appView.setWebChromeClient(testChromeClient);
++        ((AndroidWebView)appView).setWebViewClient(testViewClient);
++        ((AndroidWebView)appView).setWebChromeClient(testChromeClient);
          super.loadUrl("file:///android_asset/www/userwebview/index.html");
      }
  
 -    public class TestChromeClient extends CordovaChromeClient {
 -        public TestChromeClient(CordovaInterface ctx, CordovaWebView app) {
 +    public class TestChromeClient extends AndroidChromeClient {
-         public TestChromeClient(CordovaActivity arg0) {
-             super(arg0);
++        public TestChromeClient(CordovaInterface ctx, AndroidWebView app) {
+             super(ctx, app);
              LOG.d("userwebview", "TestChromeClient()");
          }
  
@@@ -56,9 -57,9 +57,9 @@@
      /**
       * This class can be used to override the GapViewClient and receive notification of webview events.
       */
 -    public class TestViewClient extends CordovaWebViewClient {
 -        public TestViewClient(CordovaInterface ctx, CordovaWebView app) {
 +    public class TestViewClient extends AndroidWebViewClient {
-         public TestViewClient(CordovaActivity arg0) {
-             super(arg0);
++        public TestViewClient(CordovaInterface ctx, AndroidWebView app) {
+             super(ctx, app);
              LOG.d("userwebview", "TestViewClient()");
          }
  

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f38c4605/test/src/org/apache/cordova/test/whitelist.java
----------------------------------------------------------------------
diff --cc test/src/org/apache/cordova/test/whitelist.java
index 5dbb645,c949893..0017372
--- a/test/src/org/apache/cordova/test/whitelist.java
+++ b/test/src/org/apache/cordova/test/whitelist.java
@@@ -22,22 -22,24 +22,23 @@@ import android.os.Bundle
  import android.webkit.WebView;
  
  import org.apache.cordova.*;
 -import org.apache.cordova.LOG;
  
- public class whitelist extends CordovaActivity {
+ public class whitelist extends MainTestActivity {
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
-         super.init(new AndroidWebView(this), new TestViewClient(this), new AndroidChromeClient(this));
+         super.init();
 -        appView.setWebViewClient(new TestViewClient(this, appView));
++        ((AndroidWebView)appView).setWebViewClient(new TestViewClient(this, ((AndroidWebView)appView)));
          super.loadUrl("file:///android_asset/www/whitelist/index.html");
      }
  
      /**
       * This class can be used to override the GapViewClient and receive notification of webview events.
       */
 -    public class TestViewClient extends CordovaWebViewClient {
 +    public class TestViewClient extends AndroidWebViewClient {
  
-         public TestViewClient(CordovaActivity arg0) {
-             super(arg0);
 -        public TestViewClient(CordovaInterface ctx, CordovaWebView app) {
++        public TestViewClient(CordovaInterface ctx, AndroidWebView app) {
+             super(ctx, app);
          }
  
          @Override