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

Unified Diff: chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java

Issue 63373003: [chromedriver] Add a WebView shell app for testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't run the test just yet Created 7 years, 1 month 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 | « chrome/test/chromedriver/test/webview_shell/java/res/layout/main_layout.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java
diff --git a/chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java b/chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java
new file mode 100644
index 0000000000000000000000000000000000000000..aa13b6d066f5fc8c7177a9461f74359d3ce35e43
--- /dev/null
+++ b/chrome/test/chromedriver/test/webview_shell/java/src/org/chromium/chromedriver_webview_shell/Main.java
@@ -0,0 +1,61 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chromedriver_webview_shell;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.Window;
+import android.webkit.WebChromeClient;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.Toast;
+
+public class Main extends Activity {
+ private WebView mWebView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ getWindow().requestFeature(Window.FEATURE_PROGRESS);
+ setContentView(R.layout.main_layout);
+
+ WebView.setWebContentsDebuggingEnabled(true);
+ mWebView = (WebView) findViewById(R.id.webview);
+ WebSettings webSettings = mWebView.getSettings();
+ webSettings.setJavaScriptEnabled(true);
+
+ final Activity activity = this;
+ mWebView.setWebChromeClient(new WebChromeClient() {
+ public void onProgressChanged(WebView view, int progress) {
+ activity.setProgress(progress * 100);
+ }
+ });
+ mWebView.setWebViewClient(new WebViewClient() {
+ public void onReceivedError(WebView view, int errorCode, String description,
+ String failingUrl) {
+ Toast.makeText(activity, "Error: " + description, Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ loadUrl(getIntent());
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ loadUrl(intent);
+ }
+
+ private void loadUrl(Intent intent) {
+ if (intent != null && intent.getDataString() != null) {
+ mWebView.loadUrl(intent.getDataString());
+ }
+ }
+}
« no previous file with comments | « chrome/test/chromedriver/test/webview_shell/java/res/layout/main_layout.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698