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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.android_webview.test;
6
7 import android.test.suitebuilder.annotation.SmallTest;
8 import android.webkit.ValueCallback;
9
10 import org.chromium.android_webview.AwQuotaManagerBridge;
11 import org.chromium.content.browser.test.util.CallbackHelper;
12
13 import java.util.concurrent.Callable;
14
15 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
16
17 private AwQuotaManagerBridge getQuotaManagerBridge() throws Throwable {
18 return runTestOnUiThreadAndGetResult(new Callable<AwQuotaManagerBridge>() {
19 @Override
20 public AwQuotaManagerBridge call() throws Exception {
21 return AwQuotaManagerBridge.getInstance();
22 }
23 });
24 }
25
26 @SmallTest
27 public void testDeleteAllDataExerciseCodePath() throws Throwable {
28 final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
29 getInstrumentation().runOnMainSync(new Runnable() {
30 @Override
31 public void run() {
32 bridge.deleteAllData();
33 }
34 });
35 }
36
37 @SmallTest
38 public void testDeleteOriginExerciseCodePath() throws Throwable {
39 final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
40 getInstrumentation().runOnMainSync(new Runnable() {
41 @Override
42 public void run() {
43 bridge.deleteOrigin("foo.com");
44 }
45 });
46 }
47
48 @SmallTest
49 public void testGetOriginsExerciseCodePath() throws Throwable {
50 final CallbackHelper callbackHelper = new CallbackHelper();
51 final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
52
53 int callCount = callbackHelper.getCallCount();
54 getInstrumentation().runOnMainSync(new Runnable() {
55 @Override
56 public void run() {
57 bridge.getOrigins(
58 new ValueCallback<AwQuotaManagerBridge.Origins>() {
59 @Override
60 public void onReceiveValue(AwQuotaManagerBridge.Origins or igins) {
61 callbackHelper.notifyCalled();
62 }
63 }
64 );
65 }
66 });
67 callbackHelper.waitForCallback(callCount);
68 }
69
70 @SmallTest
71 public void testGetQuotaForOriginExerciseCodePath() throws Throwable {
72 final CallbackHelper callbackHelper = new CallbackHelper();
73 final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
74
75 int callCount = callbackHelper.getCallCount();
76 getInstrumentation().runOnMainSync(new Runnable() {
77 @Override
78 public void run() {
79 bridge.getQuotaForOrigin("foo.com",
80 new ValueCallback<Long>() {
81 @Override
82 public void onReceiveValue(Long quota) {
83 callbackHelper.notifyCalled();
84 }
85 }
86 );
87 }
88 });
89 callbackHelper.waitForCallback(callCount);
90 }
91
92 @SmallTest
93 public void testGetUsageForOriginExerciseCodePath() throws Throwable {
94 final CallbackHelper callbackHelper = new CallbackHelper();
95 final AwQuotaManagerBridge bridge = getQuotaManagerBridge();
96
97 int callCount = callbackHelper.getCallCount();
98 getInstrumentation().runOnMainSync(new Runnable() {
99 @Override
100 public void run() {
101 bridge.getUsageForOrigin("foo.com",
102 new ValueCallback<Long>() {
103 @Override
104 public void onReceiveValue(Long usage) {
105 callbackHelper.notifyCalled();
106 }
107 }
108 );
109 }
110 });
111 callbackHelper.waitForCallback(callCount);
112 }
113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698