diff options
author | Tim Volodine <timvolodine@google.com> | 2015-03-24 15:28:49 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-24 15:28:51 +0000 |
commit | a030587565b13051f925622550f3a554a4ddb661 (patch) | |
tree | c707a30dc98428e52bb1f2b44094fd4376ee2206 /chromium | |
parent | 842f1b0ca3b90dfd395b31c9269aa27ac31e236d (diff) | |
parent | 871ddc7732aadcfffbea2a72e3e6f9a4e6c0f2a7 (diff) | |
download | webview-a030587565b13051f925622550f3a554a4ddb661.tar.gz |
Merge "Add WebViewBrowserActivity and cleanup to WebViewShell."
Diffstat (limited to 'chromium')
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; + } + +} |