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