Commit 6aac98ab authored by dpranke's avatar dpranke Committed by Commit bot

Revert #315148 "[Android] Convert ContentShellTest.apk to isolate."

This reverts commit 4cf59ffa.

This patch appears to break the contentshell_instrumentation_tests on
the chromium.webkit waterfall. I'm not sure what to do about this,
as the .webkit tests appear to be run in a completely different
way than the .linux (main waterfall) tests, but I'm reverting this
for now and we can sort it out later.

TBR=jbudorick@chromium.org, maruel@chromium.org
BUG=400499

> Author: jbudorick <jbudorick@chromium.org>
> Date:   Fri Feb 6 16:43:24 2015 -0800
>
>     [Android] Convert ContentShellTest.apk to isolate.
>
>     We were previously using --test-data to push files from
>     //content/test/data/android/device_files to
>     $EXTERNAL_STORAGE/chrome/test/data/content. Switching to isolate lets
>     us handle all of our instrumentation and gtest data dependencies in the
>     same way. It will also facilitate using isolate to optimize transfers
>     between builders and testers.
>
>     BUG=400499
>     TBR=maruel@chromium.org
>
>     Review URL: https://codereview.chromium.org/878163004
>
>     Cr-Commit-Position: refs/heads/master@{#315148}

Review URL: https://codereview.chromium.org/886993003

Cr-Commit-Position: refs/heads/master@{#315220}
parent 260c79f5
......@@ -16,41 +16,20 @@ public class UrlUtils {
/**
* Construct the full path of a test data file.
* @param path Pathname relative to external/chrome/test/data
* @param path Pathname relative to external/chrome/testing/data
*/
public static String getTestFilePath(String path) {
// TODO(jbudorick): Remove DATA_DIR once everything has been isolated. crbug/400499
return PathUtils.getExternalStorageDirectory() + DATA_DIR + path;
}
// TODO(jbudorick): Remove this function once everything has been isolated and switched back
// to getTestFilePath. crbug/400499
/**
* Construct the full path of a test data file.
* @param path Pathname relative to external/
*/
public static String getIsolatedTestFilePath(String path) {
return PathUtils.getExternalStorageDirectory() + "/" + path;
}
/**
* Construct a suitable URL for loading a test data file.
* @param path Pathname relative to external/chrome/test/data
* @param path Pathname relative to external/chrome/testing/data
*/
public static String getTestFileUrl(String path) {
return "file://" + getTestFilePath(path);
}
// TODO(jbudorick): Remove this function once everything has been isolated and switched back
// to getTestFileUrl. crbug/400499
/**
* Construct a suitable URL for loading a test data file.
* @param path Pathname relative to external/
*/
public static String getIsolatedTestFileUrl(String path) {
return "file://" + getIsolatedTestFilePath(path);
}
/**
* Construct a data:text/html URI for loading from an inline HTML.
* @param html An unencoded HTML
......@@ -62,7 +41,8 @@ public class UrlUtils {
// ' '->'+' needs to be undone and replaced with ' '->'%20'
// to match the Data URI requirements.
String encoded =
"data:text/html;utf-8," + java.net.URLEncoder.encode(html, "UTF-8");
"data:text/html;utf-8," +
java.net.URLEncoder.encode(html, "UTF-8");
encoded = encoded.replace("+", "%20");
return encoded;
} catch (java.io.UnsupportedEncodingException e) {
......
......@@ -89,15 +89,15 @@ def Setup(test_options, devices):
if test_options.test_data:
device_utils.DeviceUtils.parallel(devices).pMap(
_PushDataDeps, test_options)
if test_options.isolate_file_path:
else:
base_setup.GenerateDepsDirUsingIsolate(test_options.test_apk,
test_options.isolate_file_path,
ISOLATE_FILE_PATHS,
DEPS_EXCLUSION_LIST)
def push_data_deps_to_device_dir(device):
base_setup.PushDataDeps(device, device.GetExternalStoragePath(),
test_options)
device_dir = os.path.join(device.GetExternalStoragePath(),
DEVICE_DATA_DIR)
base_setup.PushDataDeps(device, device_dir, test_options)
device_utils.DeviceUtils.parallel(devices).pMap(
push_data_deps_to_device_dir)
......
......@@ -6,7 +6,7 @@
['OS=="android"', {
'variables': {
'files': [
'<(DEPTH)/content/test/data/android/',
'<(DEPTH)/content/test/data/android/device_files/',
'<(DEPTH)/net/data/ssl/certificates/crit-codeSigning-chain.pem',
'<(DEPTH)/net/data/ssl/certificates/eku-test-root.pem',
'<(DEPTH)/net/data/ssl/certificates/invalid_key_usage_cert.der',
......
......@@ -24,8 +24,7 @@ public class AddressDetectionTest extends ContentDetectionTestBase {
@MediumTest
@Feature({"ContentDetection", "TabContents"})
public void testMultipleAddressesInText() throws Throwable {
startActivityWithTestUrl(
"content/test/data/android/content_detection/geo_address_multiple.html");
startActivityWithTestUrl("content/content_detection/geo_address_multiple.html");
assertWaitForPageScaleFactorMatch(1.0f);
assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
......@@ -38,8 +37,7 @@ public class AddressDetectionTest extends ContentDetectionTestBase {
@MediumTest
@Feature({"ContentDetection", "TabContents"})
public void testSplitAddresses() throws Throwable {
startActivityWithTestUrl(
"content/test/data/android/content_detection/geo_address_split.html");
startActivityWithTestUrl("content/content_detection/geo_address_split.html");
assertWaitForPageScaleFactorMatch(1.0f);
assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
......@@ -58,8 +56,7 @@ public class AddressDetectionTest extends ContentDetectionTestBase {
@MediumTest
@Feature({"ContentDetection", "TabContents"})
public void testAddressLimits() throws Throwable {
startActivityWithTestUrl(
"content/test/data/android/content_detection/geo_address_limits.html");
startActivityWithTestUrl("content/content_detection/geo_address_limits.html");
assertWaitForPageScaleFactorMatch(1.0f);
assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
......@@ -78,8 +75,7 @@ public class AddressDetectionTest extends ContentDetectionTestBase {
@MediumTest
@Feature({"ContentDetection", "TabContents"})
public void testRealAddresses() throws Throwable {
startActivityWithTestUrl(
"content/test/data/android/content_detection/geo_address_real.html");
startActivityWithTestUrl("content/content_detection/geo_address_real.html");
assertWaitForPageScaleFactorMatch(1.0f);
assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
......@@ -98,8 +94,7 @@ public class AddressDetectionTest extends ContentDetectionTestBase {
@MediumTest
@Feature({"ContentDetection", "TabContents"})
public void testSpecialChars() throws Throwable {
startActivityWithTestUrl(
"content/test/data/android/content_detection/geo_address_special_chars.html");
startActivityWithTestUrl("content/content_detection/geo_address_special_chars.html");
assertWaitForPageScaleFactorMatch(1.0f);
assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
......
......@@ -16,37 +16,34 @@ public class ClickListenerTest extends ContentDetectionTestBase {
@MediumTest
@Feature({"ContentDetection", "TabContents"})
public void testClickContentOnLink() throws Throwable {
startActivityWithTestUrl(
"content/test/data/android/content_detection/click_listeners.html");
startActivityWithTestUrl("content/content_detection/click_listeners.html");
assertWaitForPageScaleFactorMatch(1.0f);
// Clicks on addresses in links should change the url.
scrollAndTapNavigatingOut("linktest");
assertTrue(isCurrentTestUrl("content/test/data/android/content_detection/empty.html"));
assertTrue(isCurrentTestUrl("content/content_detection/empty.html"));
}
@MediumTest
@Feature({"ContentDetection", "TabContents"})
public void testClickContentOnJSListener1() throws Throwable {
startActivityWithTestUrl(
"content/test/data/android/content_detection/click_listeners.html");
startActivityWithTestUrl("content/content_detection/click_listeners.html");
assertWaitForPageScaleFactorMatch(1.0f);
// Clicks on addresses in elements listening to click events should be
// processed normally without address detection.
scrollAndTapNavigatingOut("clicktest1");
assertTrue(isCurrentTestUrl("content/test/data/android/content_detection/empty.html"));
assertTrue(isCurrentTestUrl("content/content_detection/empty.html"));
}
@MediumTest
@Feature({"ContentDetection", "TabContents"})
public void testClickContentOnJSListener2() throws Throwable {
startActivityWithTestUrl(
"content/test/data/android/content_detection/click_listeners.html");
startActivityWithTestUrl("content/content_detection/click_listeners.html");
assertWaitForPageScaleFactorMatch(1.0f);
// Same as previous test, but using addEventListener instead of onclick.
scrollAndTapNavigatingOut("clicktest2");
assertTrue(isCurrentTestUrl("content/test/data/android/content_detection/empty.html"));
assertTrue(isCurrentTestUrl("content/content_detection/empty.html"));
}
}
......@@ -52,7 +52,7 @@ public class ContentDetectionTestBase extends ContentShellTestBase {
* @return true if the test url is the current one, false otherwise.
*/
protected boolean isCurrentTestUrl(String testUrl) {
return UrlUtils.getIsolatedTestFileUrl(testUrl).equals(getContentViewCore()
return UrlUtils.getTestFileUrl(testUrl).equals(getContentViewCore()
.getWebContents().getUrl());
}
......
......@@ -87,7 +87,7 @@ public class ContentViewLocationTest extends ContentShellTestBase {
LocationProviderFactory.setLocationProviderImpl(mMockLocationProvider);
try {
startActivityWithTestUrl("content/test/data/android/geolocation.html");
startActivityWithTestUrl("content/geolocation.html");
} catch (Throwable t) {
fail();
}
......
......@@ -24,7 +24,7 @@ public class EmailAddressDetectionTest extends ContentDetectionTestBase {
@MediumTest
@Feature({"ContentDetection", "TabContents"})
public void testValidEmailAddresses() throws Throwable {
startActivityWithTestUrl("content/test/data/android/content_detection/email.html");
startActivityWithTestUrl("content/content_detection/email.html");
assertWaitForPageScaleFactorMatch(1.0f);
// valid_1: i.want.a.pony@chromium.org.
......
......@@ -75,11 +75,10 @@ public class ContentShellTestBase
* @param url Test url to load.
*/
protected void startActivityWithTestUrl(String url) throws Throwable {
launchContentShellWithUrl(UrlUtils.getIsolatedTestFileUrl(url));
launchContentShellWithUrl(UrlUtils.getTestFileUrl(url));
assertNotNull(getActivity());
assertTrue(waitForActiveShellToBeDoneLoading());
assertEquals(UrlUtils.getIsolatedTestFileUrl(url),
getContentViewCore().getWebContents().getUrl());
assertEquals(UrlUtils.getTestFileUrl(url), getContentViewCore().getWebContents().getUrl());
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment