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

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

Issue 12253057: Implement WebStorage API methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation mostly done. Created 7 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
Index: android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..04fd2ad41bec244113f97f11c0bf339490a87fcc
--- /dev/null
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java
@@ -0,0 +1,113 @@
+// Copyright (c) 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.android_webview.test;
+
+import android.test.suitebuilder.annotation.SmallTest;
+import android.webkit.ValueCallback;
+
+import org.chromium.android_webview.AwQuotaManagerBridge;
+import org.chromium.content.browser.test.util.CallbackHelper;
+
+import java.util.concurrent.Callable;
+
+public class AwQuotaManagerBridgeTest extends AndroidWebViewTestBase {
mkosiba (inactive) 2013/02/19 11:37:13 ah, I assume you need the browser process to be se
boliu 2013/02/19 17:03:21 I'm not sure actually but I don't think so current
+
+ private AwQuotaManagerBridge getQuotaManagerBridge() throws Throwable {
+ return runTestOnUiThreadAndGetResult(new Callable<AwQuotaManagerBridge>() {
+ @Override
+ public AwQuotaManagerBridge call() throws Exception {
+ return AwQuotaManagerBridge.getInstance();
+ }
+ });
+ }
+
+ @SmallTest
+ public void testDeleteAllDataExerciseCodePath() throws Throwable {
+ final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ bridge.deleteAllData();
+ }
+ });
+ }
+
+ @SmallTest
+ public void testDeleteOriginExerciseCodePath() throws Throwable {
+ final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ bridge.deleteOrigin("foo.com");
+ }
+ });
+ }
+
+ @SmallTest
+ public void testGetOriginsExerciseCodePath() throws Throwable {
+ final CallbackHelper callbackHelper = new CallbackHelper();
+ final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
+
+ int callCount = callbackHelper.getCallCount();
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ bridge.getOrigins(
+ new ValueCallback<AwQuotaManagerBridge.Origins>() {
+ @Override
+ public void onReceiveValue(AwQuotaManagerBridge.Origins origins) {
+ callbackHelper.notifyCalled();
+ }
+ }
+ );
+ }
+ });
+ callbackHelper.waitForCallback(callCount);
+ }
+
+ @SmallTest
+ public void testGetQuotaForOriginExerciseCodePath() throws Throwable {
+ final CallbackHelper callbackHelper = new CallbackHelper();
+ final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
+
+ int callCount = callbackHelper.getCallCount();
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ bridge.getQuotaForOrigin("foo.com",
+ new ValueCallback<Long>() {
+ @Override
+ public void onReceiveValue(Long quota) {
+ callbackHelper.notifyCalled();
+ }
+ }
+ );
+ }
+ });
+ callbackHelper.waitForCallback(callCount);
+ }
+
+ @SmallTest
+ public void testGetUsageForOriginExerciseCodePath() throws Throwable {
+ final CallbackHelper callbackHelper = new CallbackHelper();
+ final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
+
+ int callCount = callbackHelper.getCallCount();
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ bridge.getUsageForOrigin("foo.com",
+ new ValueCallback<Long>() {
+ @Override
+ public void onReceiveValue(Long usage) {
+ callbackHelper.notifyCalled();
+ }
+ }
+ );
+ }
+ });
+ callbackHelper.waitForCallback(callCount);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698