summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Volodine <timvolodine@google.com>2015-03-19 14:43:52 +0000
committerTim Volodine <timvolodine@google.com>2015-03-23 18:26:35 +0000
commit871ddc7732aadcfffbea2a72e3e6f9a4e6c0f2a7 (patch)
treedf2f47418199fade882767b00452f8075c4109a4
parentf12c9f599e2e9e6ef8b4eb5341441caac62addf1 (diff)
downloadandroid_frameworks_webview-871ddc7732aadcfffbea2a72e3e6f9a4e6c0f2a7.tar.gz
android_frameworks_webview-871ddc7732aadcfffbea2a72e3e6f9a4e6c0f2a7.tar.bz2
android_frameworks_webview-871ddc7732aadcfffbea2a72e3e6f9a4e6c0f2a7.zip
Add WebViewBrowserActivity and cleanup to WebViewShell.
Add activity for displaying urls for testing in WebViewShell. Also clean up some bits while at it. Change-Id: Id3a78328493be5ca2ebb0b9393f08387999315a7
-rw-r--r--chromium/tools/WebViewShell/AndroidManifest.xml29
-rw-r--r--chromium/tools/WebViewShell/res/values/strings.xml1
-rw-r--r--chromium/tools/WebViewShell/src/com/android/webview/chromium/shell/WebViewBrowserActivity.java55
3 files changed, 72 insertions, 13 deletions
diff --git a/chromium/tools/WebViewShell/AndroidManifest.xml b/chromium/tools/WebViewShell/AndroidManifest.xml
index 77997cd..9f03b6c 100644
--- a/chromium/tools/WebViewShell/AndroidManifest.xml
+++ b/chromium/tools/WebViewShell/AndroidManifest.xml
@@ -20,7 +20,7 @@
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="17"
- android:targetSdkVersion="19" />
+ android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
@@ -31,28 +31,31 @@
android:theme="@android:style/Theme.Light" >
<activity
android:name=".TelemetryActivity"
- android:label="@string/title_activity_telemetry" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
+ android:label="@string/title_activity_telemetry"
+ android:exported="true">
</activity>
<activity
android:name=".JankActivity"
android:label="@string/title_activity_jank"
- android:noHistory="true">
- <intent-filter>
- <action android:name="android.intent.action.VIEW" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
+ android:noHistory="true"
+ android:exported="true">
</activity>
<activity
android:name=".StartupTimeActivity"
android:label="@string/title_activity_startup_time"
- android:noHistory="true">
+ android:noHistory="true"
+ android:exported="true">
+ </activity>
+ <activity
+ android:name=".WebViewBrowserActivity"
+ android:label="@string/title_activity_browser"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
- <category android:name="android.intent.category.LAUNCHER" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="http" />
+ <data android:scheme="https" />
</intent-filter>
</activity>
</application>
diff --git a/chromium/tools/WebViewShell/res/values/strings.xml b/chromium/tools/WebViewShell/res/values/strings.xml
index f5df5b9..00085bf 100644
--- a/chromium/tools/WebViewShell/res/values/strings.xml
+++ b/chromium/tools/WebViewShell/res/values/strings.xml
@@ -19,4 +19,5 @@
<string name="title_activity_telemetry">WebView Telemetry</string>
<string name="title_activity_jank">WebView Jank Tester</string>
<string name="title_activity_startup_time">WebView Startup Time Tester</string>
+ <string name="title_activity_browser">WebView Browser Tester</string>
</resources>
diff --git a/chromium/tools/WebViewShell/src/com/android/webview/chromium/shell/WebViewBrowserActivity.java b/chromium/tools/WebViewShell/src/com/android/webview/chromium/shell/WebViewBrowserActivity.java
new file mode 100644
index 0000000..f1dfcf4
--- /dev/null
+++ b/chromium/tools/WebViewShell/src/com/android/webview/chromium/shell/WebViewBrowserActivity.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.webview.chromium.shell;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.webkit.CookieManager;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+/**
+ * This activity is designed for URL browsing testing of WebView. It takes a URL as an argument, and
+ * displays the page.
+ */
+public class WebViewBrowserActivity extends Activity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getWindow().setTitle(
+ getResources().getString(R.string.title_activity_browser));
+ setContentView(R.layout.activity_telemetry);
+ WebView webView = (WebView) findViewById(R.id.webview);
+
+ webView.setWebViewClient(new WebViewClient() {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView webView, String url) {
+ return false;
+ }
+ });
+
+ String url = getUrlFromIntent(getIntent());
+ webView.loadUrl(url);
+ }
+
+ private static String getUrlFromIntent(Intent intent) {
+ return intent != null ? intent.getDataString() : null;
+ }
+
+}