Skip to content

Commit

Permalink
Move Android WebView Test WebServer to net.
Browse files Browse the repository at this point in the history
Move Android WebView Test WebServer to net so that other test code can
make use of it.

BUG=159601


Review URL: https://chromiumcodereview.appspot.com/11366108

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166493 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jknotten@chromium.org committed Nov 7, 2012
1 parent 1d7774f commit f36fb17
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 19 deletions.
3 changes: 2 additions & 1 deletion android_webview/android_webview_tests.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
'dependencies': [
'../base/base.gyp:base_java_test_support',
'../content/content.gyp:content_java_test_support',
'android_webview_java',
'../net/net.gyp:net_java_test_support',
'android_webview_java',
'libwebviewchromium',
],
'variables': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.LoadUrlParams;
import org.chromium.content.browser.test.util.CallbackHelper;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.net.test.util.TestWebServer;

import java.util.concurrent.TimeUnit;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

import org.apache.http.util.EncodingUtils;
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
import org.chromium.net.test.util.TestWebServer;

import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.test.util.CommonResources;
import org.chromium.android_webview.test.util.JSUtils;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.NavigationHistory;
Expand All @@ -24,6 +23,7 @@
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageStartedHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnReceivedErrorHelper;
import org.chromium.net.test.util.TestWebServer;

import java.net.URLEncoder;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import org.chromium.android_webview.InterceptedRequestData;
import org.chromium.android_webview.test.util.CommonResources;
import org.chromium.android_webview.test.util.JSUtils;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.CallbackHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageStartedHelper;
import org.chromium.net.test.util.TestWebServer;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.test.util.CommonResources;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.content.browser.test.util.CallbackHelper;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.net.test.util.TestWebServer;

import java.io.InputStream;
import java.net.URL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.chromium.android_webview.AwSettings;
import org.chromium.android_webview.test.util.CommonResources;
import org.chromium.android_webview.test.util.ImagePageGenerator;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.TestFileUtil;
Expand All @@ -26,6 +25,7 @@
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.HistoryUtils;
import org.chromium.net.test.util.TestWebServer;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import android.test.suitebuilder.annotation.MediumTest;

import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
import org.chromium.net.test.util.TestWebServer;

/**
* Tests for the ContentViewClient.onPageFinished() method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.CookieManager;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper;
import org.chromium.net.test.util.TestWebServer;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import android.test.suitebuilder.annotation.Smoke;

import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.net.test.util.TestWebServer;

/**
* A test suite for ContentView.getTitle().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.chromium.android_webview.AndroidProtocolHandler;
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.test.util.CommonResources;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.content.browser.test.util.Criteria;
Expand All @@ -20,6 +19,7 @@
import org.chromium.content.browser.LoadUrlParams;
import org.chromium.content.browser.test.util.HistoryUtils;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
import org.chromium.net.test.util.TestWebServer;

import java.io.File;
import java.io.FileOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.test.util.CommonResources;
import org.chromium.android_webview.test.util.TestWebServer;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.content.browser.NavigationEntry;
import org.chromium.content.browser.NavigationHistory;
import org.chromium.content.browser.test.util.HistoryUtils;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
import org.chromium.net.test.util.TestWebServer;

import java.util.concurrent.Callable;

Expand Down
7 changes: 3 additions & 4 deletions build/android/findbugs_filter/findbugs_known_bugs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ H B ES: Comparison of String parameter using == or != in org.chromium.android_we
H B Nm: The class name org.chromium.content.browser.test.util.TouchUtils shadows the simple name of the superclass android.test.TouchUtils At TouchUtils.java
H C EC: Using pointer equality to compare a JavaBridgeCoercionTest$CustomType with a JavaBridgeCoercionTest$CustomType2 in org.chromium.content.browser.JavaBridgeCoercionTest.testPassJavaObject() At JavaBridgeCoercionTest.java
H D RCN: Redundant nullcheck of org.chromium.content.browser.SandboxedProcessConnection.mConnectionParams, which is known to be non-null in org.chromium.content.browser.SandboxedProcessConnection.doConnectionSetup() Redundant null check at SandboxedProcessConnection.java
H D ST: Write to static field org.chromium.android_webview.test.util.TestWebServer.sInstance from instance method org.chromium.android_webview.test.util.TestWebServer.shutdown() At TestWebServer.java
H D ST: Write to static field org.chromium.content.app.SandboxedProcessService.sContext from instance method org.chromium.content.app.SandboxedProcessService.onCreate() At SandboxedProcessService.java
H V MS: org.chromium.android_webview.test.AndroidWebViewTestBase.WAIT_TIMEOUT_SECONDS isn't final but should be At AndroidWebViewTestBase.java
H V MS: org.chromium.android_webview.test.LoadDataWithBaseUrlTest.WAIT_TIMEOUT_SECONDS isn't final but should be At LoadDataWithBaseUrlTest.java
Expand Down Expand Up @@ -139,7 +138,7 @@ M D DLS: Dead store to eventTime in org.chromium.content.browser.LongPressDetect
M D DLS: Dead store to onPageFinishedHelper in org.chromium.android_webview.test.AwSettingsTest.testLoadsImagesAutomaticallyNoPageReload() At AwSettingsTest.java
M D DLS: Dead store to prevEditableLength in org.chromium.content.browser.ImeAdapter$AdapterInputConnection.setEditableText(String, int, int, int, int) At ImeAdapter.java
M D DLS: Dead store to testUrl in org.chromium.android_webview.test.ClientOnPageFinishedTest.testOnPageFinishedNotCalledForValidSubresources() At ClientOnPageFinishedTest.java
M D DLS: Dead store to time in org.chromium.android_webview.test.util.TestWebServer.setDateHeaders(HttpResponse) At TestWebServer.java
M D DLS: Dead store to time in org.chromium.base.test.util.TestWebServer.setDateHeaders(HttpResponse) At TestWebServer.java
M D DMI: Hard coded reference to an absolute pathname in org.chromium.android_webview.test.ArchiveTest.testAutoBadPath() At ArchiveTest.java
M D DMI: Hard coded reference to an absolute pathname in org.chromium.android_webview.test.ArchiveTest.testExplicitBadPath() At ArchiveTest.java
M D ICAST: Result of integer multiplication cast to long in org.chromium.android_webview.test.AwContentsClientShouldIgnoreNavigationTest.testShouldIgnoreNavigationNotCalledForPostNavigations() At AwContentsClientShouldIgnoreNavigationTest.java
Expand All @@ -151,7 +150,7 @@ M D SF: Switch statement found in org.chromium.chrome.browser.database.SQLiteCur
M D SF: Switch statement found in org.chromium.content.browser.ContentSettings$EventHandler$1.handleMessage(Message) where default case is missing At ContentSettings.java
M D SF: Switch statement found in org.chromium.content.browser.HandleView.onTouchEvent(MotionEvent) where default case is missing At HandleView.java
M D SF: Switch statement found in org.chromium.content.browser.ImeAdapter$AdapterInputConnection.performEditorAction(int) where default case is missing At ImeAdapter.java
M D ST: Write to static field org.chromium.android_webview.test.util.TestWebServer.sInstance from instance method new org.chromium.android_webview.test.util.TestWebServer(boolean) At TestWebServer.java
M D ST: Write to static field org.chromium.base.test.util.TestWebServer.sInstance from instance method new org.chromium.base.test.util.TestWebServer(boolean) At TestWebServer.java
M D UrF: Unread public/protected field: org.chromium.content.browser.JavaBridgeBasicsTest$21.field At JavaBridgeBasicsTest.java
M D UrF: Unread public/protected field: org.chromium.content.browser.JavaBridgeFieldsTest$TestObject.booleanField At JavaBridgeFieldsTest.java
M D UrF: Unread public/protected field: org.chromium.content.browser.JavaBridgeFieldsTest$TestObject.byteField At JavaBridgeFieldsTest.java
Expand All @@ -168,7 +167,7 @@ M D UuF: Unused public or protected field: org.chromium.content.browser.JavaBrid
M M IS: Inconsistent synchronization of org.chromium.content.browser.SandboxedProcessConnection.mPID; locked 66% of time Unsynchronized access at SandboxedProcessConnection.java
M M IS: Inconsistent synchronization of org.chromium.content.browser.SandboxedProcessConnection.mService; locked 55% of time Unsynchronized access at SandboxedProcessConnection.java
M M IS: Inconsistent synchronization of org.chromium.content.browser.SandboxedProcessConnection.mServiceConnectComplete; locked 60% of time Unsynchronized access at SandboxedProcessConnection.java
M M LI: Incorrect lazy initialization and update of static field org.chromium.android_webview.test.util.TestWebServer.sReasons in org.chromium.android_webview.test.util.TestWebServer.createResponse(int) At TestWebServer.java
M M LI: Incorrect lazy initialization and update of static field org.chromium.base.test.util.TestWebServer.sReasons in org.chromium.base.test.util.TestWebServer.createResponse(int) At TestWebServer.java
M M LI: Incorrect lazy initialization and update of static field org.chromium.content.browser.ContentVideoView.sContentVideoView in org.chromium.content.browser.ContentVideoView.createContentVideoView(int) At ContentVideoView.java
M M LI: Incorrect lazy initialization of static field org.chromium.net.NetworkChangeNotifier.sInstance in org.chromium.net.NetworkChangeNotifier.createInstance(Context, int) At NetworkChangeNotifier.java
M M NN: Naked notify in org.chromium.content.browser.VSyncMonitorTest$VSyncDataCollector.onVSync(VSyncMonitor, long) At VSyncMonitorTest.java
Expand Down
4 changes: 3 additions & 1 deletion net/android/OWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
jrg@chromium.org
digit@chromium.org
jknotten@chromium.org
pliard@chromium.org
yfriedman@chromium.org
9 changes: 9 additions & 0 deletions net/net.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2265,6 +2265,15 @@
],
'includes': [ '../build/java.gypi' ],
},
{
'target_name': 'net_java_test_support',
'type': 'none',
'variables': {
'package_name': 'net_java_test_support',
'java_in_dir': '../net/test/android/javatests',
},
'includes': [ '../build/java.gypi' ],
},
{
'target_name': 'net_javatests',
'type': 'none',
Expand Down
4 changes: 4 additions & 0 deletions net/test/android/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
digit@chromium.org
jknotten@chromium.org
pliard@chromium.org
yfriedman@chromium.org
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.android_webview.test.util;
package org.chromium.net.test.util;

import android.util.Base64;
import android.util.Log;
Expand Down Expand Up @@ -54,6 +54,10 @@
/**
* Simple http test server for testing.
*
* This server runs in a thread in the current process, so it is convenient
* for loopback testing without the need to setup tcp forwarding to the
* host computer.
*
* Based heavily on the CTSWebServer in Android.
*/
public class TestWebServer {
Expand Down Expand Up @@ -142,7 +146,7 @@ public void shutdown() {
throw new IllegalStateException(e);
}

sInstance = null;
TestWebServer.sInstance = null;
}

private final static int RESPONSE_STATUS_NORMAL = 0;
Expand Down

0 comments on commit f36fb17

Please sign in to comment.