Commit a29eb756 authored by mnaganov@chromium.org's avatar mnaganov@chromium.org

[android_webview] GetTitleTest.testGetTitleWithWriteln -> ...testGetTitleSetFromJS

First, turning on JS, which is disabled by default.

Also, no one guarantees that onload + writeln + onPageFinished must work as
you'd expect, so there is no point in testing this scenario. So just change this
test to verify that the title updated via JS is reported by GetTitle.

BUG=151012

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243537 0039d316-1c4b-4281-b951-d872f2087c98
parent f898b175
......@@ -8,7 +8,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import android.test.suitebuilder.annotation.Smoke;
import org.chromium.android_webview.AwContents;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.net.test.util.TestWebServer;
......@@ -149,21 +148,16 @@ public class GetTitleTest extends AwTestBase {
assertEquals("Incorrect title :: " , info.mUrl, info.mTitle);
}
/**
* A subtle bug started to appear after the merge to r157579. If document.writeln is
* used in the page's script then the page's title is reported incorrectly.
* Bug: crbug.com/151012
* @SmallTest
* @Feature({"AndroidWebView"})
*/
@DisabledTest
public void testGetTitleWithWriteln() throws Throwable {
@SmallTest
@Feature({"AndroidWebView"})
public void testGetTitleSetFromJS() throws Throwable {
final String expectedTitle = "Expected";
final String page =
// Note: document.title="...";document.writeln(document.title); also fails.
"<html>" +
"<body onload='document.writeln(document.title=\"" + expectedTitle + "\")'>" +
"<html><head>" +
"<script>document.title=\"" + expectedTitle + "\"</script>" +
"</head><body>" +
"</body></html>";
getAwSettingsOnUiThread(mAwContents).setJavaScriptEnabled(true);
final String title = loadFromDataAndGetTitle(page);
assertEquals("Incorrect title :: ", expectedTitle, title);
}
......
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