Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1829)

Unified Diff: android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java

Issue 882063004: aw: Auto prepend http scheme in test shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
index bd490f4c783198ed29d91b3324852d031e474cd9..35d807a023028e5923e9643ce5a881037f3462f7 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
@@ -42,6 +42,9 @@ import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.NavigationController;
import org.chromium.content_public.browser.WebContents;
+import java.net.URI;
+import java.net.URISyntaxException;
+
/**
* This is a lightweight activity for tests that only require WebView functionality.
*/
@@ -195,8 +198,18 @@ public class AwShellActivity extends Activity {
return false;
}
- mAwTestContainerView.getAwContents().loadUrl(
- new LoadUrlParams(mUrlTextView.getText().toString()));
+ String url = mUrlTextView.getText().toString();
+ try {
+ URI uri = new URI(url);
+ if (uri.getScheme() == null) {
+ url = "http://" + uri.toString();
+ } else {
+ url = uri.toString();
+ }
+ } catch (URISyntaxException e) {
+ // Ignore syntax errors.
+ }
+ mAwTestContainerView.getAwContents().loadUrl(new LoadUrlParams(url));
mUrlTextView.clearFocus();
setKeyboardVisibilityForUrl(false);
mAwTestContainerView.requestFocus();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698