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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java

Issue 2568713003: [Android] Switch AwContentsTest to EmbeddedTestServer (Closed)
Patch Set: Selim comment Created 4 years 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
Index: android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
index 9e97a601557d9a8848db8c93846f6e51e064f004..d37e9b403167ac66b2eb8782a79de154787a64a8 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
@@ -42,6 +42,8 @@ import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* A base class for android_webview tests. WebView only runs on KitKat and later,
@@ -71,6 +73,7 @@ public class AwTestBase
public static final long WAIT_TIMEOUT_MS = scaleTimeout(15000);
public static final int CHECK_INTERVAL = 100;
private static final String TAG = "AwTestBase";
+ private static final Pattern MAYBE_QUOTED_STRING = Pattern.compile("^(\"?)(.*)\\1$");
// The browser context needs to be a process-wide singleton.
private AwBrowserContext mBrowserContext;
@@ -504,6 +507,17 @@ public class AwTestBase
}
/**
+ * Verify double quotes in both sides of the raw string. Strip the double quotes and
+ * returns rest of the string.
+ */
+ protected String maybeStripDoubleQuotes(String raw) {
+ assertNotNull(raw);
+ Matcher m = MAYBE_QUOTED_STRING.matcher(raw);
+ assertTrue(m.matches());
+ return m.group(2);
+ }
+
+ /**
* Executes the given snippet of JavaScript code within the given ContentView. Returns the
* result of its execution in JSON format.
*/

Powered by Google App Engine
This is Rietveld 408576698