EMMA Coverage Report (generated Tue Aug 20 10:07:21 PDT 2013)
[all classes][org.chromium.android_webview.test]

COVERAGE SUMMARY FOR SOURCE FILE [WebViewAsynchronousFindApisTest.java]

nameclass, %method, %block, %line, %
WebViewAsynchronousFindApisTest.java100% (2/2)100% (17/17)100% (260/260)100% (62/62)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class WebViewAsynchronousFindApisTest100% (1/1)100% (15/15)100% (248/248)100% (60/60)
WebViewAsynchronousFindApisTest (): void 100% (1/1)100% (3/3)100% (1/1)
testClearFindNext (): void 100% (1/1)100% (18/18)100% (5/5)
testClearMatches (): void 100% (1/1)100% (8/8)100% (3/3)
testFindAllDoesNotFind (): void 100% (1/1)100% (6/6)100% (2/2)
testFindAllDouble (): void 100% (1/1)100% (10/10)100% (3/3)
testFindAllDoubleNext (): void 100% (1/1)100% (16/16)100% (4/4)
testFindAllEmptyNext (): void 100% (1/1)100% (36/36)100% (8/8)
testFindAllEmptyPage (): void 100% (1/1)100% (6/6)100% (2/2)
testFindAllEmptyString (): void 100% (1/1)100% (6/6)100% (2/2)
testFindAllFinds (): void 100% (1/1)100% (6/6)100% (2/2)
testFindEmptyNext (): void 100% (1/1)100% (16/16)100% (4/4)
testFindNextBackward (): void 100% (1/1)100% (25/25)100% (5/5)
testFindNextBig (): void 100% (1/1)100% (40/40)100% (8/8)
testFindNextFirst (): void 100% (1/1)100% (27/27)100% (6/6)
testFindNextForward (): void 100% (1/1)100% (25/25)100% (5/5)
     
class WebViewAsynchronousFindApisTest$1100% (1/1)100% (2/2)100% (12/12)100% (3/3)
WebViewAsynchronousFindApisTest$1 (WebViewAsynchronousFindApisTest): void 100% (1/1)100% (6/6)100% (1/1)
run (): void 100% (1/1)100% (6/6)100% (2/2)

1// Copyright (c) 2012 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 
5package org.chromium.android_webview.test;
6 
7import android.test.suitebuilder.annotation.SmallTest;
8 
9import org.chromium.base.test.util.Feature;
10 
11/**
12 * Tests the asynchronous find-in-page APIs in WebView.
13 */
14public class WebViewAsynchronousFindApisTest extends WebViewFindApisTestBase {
15 
16    @SmallTest
17    @Feature({"AndroidWebView", "FindInPage"})
18    public void testFindAllFinds() throws Throwable {
19        assertEquals(4, findAllAsyncOnUiThread("wood"));
20    }
21 
22    @SmallTest
23    @Feature({"AndroidWebView", "FindInPage"})
24    public void testFindAllDouble() throws Throwable {
25        findAllAsyncOnUiThread("wood");
26        assertEquals(4, findAllAsyncOnUiThread("chuck"));
27    }
28 
29    @SmallTest
30    @Feature({"AndroidWebView", "FindInPage"})
31    public void testFindAllDoubleNext() throws Throwable {
32        assertEquals(4, findAllAsyncOnUiThread("wood"));
33        assertEquals(4, findAllAsyncOnUiThread("wood"));
34        assertEquals(2, findNextOnUiThread(true));
35    }
36 
37    @SmallTest
38    @Feature({"AndroidWebView", "FindInPage"})
39    public void testFindAllDoesNotFind() throws Throwable {
40        assertEquals(0, findAllAsyncOnUiThread("foo"));
41    }
42 
43    @SmallTest
44    @Feature({"AndroidWebView", "FindInPage"})
45    public void testFindAllEmptyPage() throws Throwable {
46        assertEquals(0, findAllAsyncOnUiThread("foo"));
47    }
48 
49    @SmallTest
50    @Feature({"AndroidWebView", "FindInPage"})
51    public void testFindAllEmptyString() throws Throwable {
52        assertEquals(0, findAllAsyncOnUiThread(""));
53    }
54 
55    @SmallTest
56    @Feature({"AndroidWebView", "FindInPage"})
57    public void testFindNextForward() throws Throwable {
58        assertEquals(4, findAllAsyncOnUiThread("wood"));
59 
60        for (int i = 2; i <= 4; i++) {
61            assertEquals(i - 1, findNextOnUiThread(true));
62        }
63        assertEquals(0, findNextOnUiThread(true));
64    }
65 
66    @SmallTest
67    @Feature({"AndroidWebView", "FindInPage"})
68    public void testFindNextBackward() throws Throwable {
69        assertEquals(4, findAllAsyncOnUiThread("wood"));
70 
71        for (int i = 4; i >= 1; i--) {
72            assertEquals(i - 1, findNextOnUiThread(false));
73        }
74        assertEquals(3, findNextOnUiThread(false));
75    }
76 
77    @SmallTest
78    @Feature({"AndroidWebView", "FindInPage"})
79    public void testFindNextBig() throws Throwable {
80        assertEquals(4, findAllAsyncOnUiThread("wood"));
81 
82        assertEquals(1, findNextOnUiThread(true));
83        assertEquals(0, findNextOnUiThread(false));
84        assertEquals(3, findNextOnUiThread(false));
85        for (int i = 1; i <= 4; i++) {
86            assertEquals(i - 1, findNextOnUiThread(true));
87        }
88        assertEquals(0, findNextOnUiThread(true));
89    }
90 
91    @SmallTest
92    @Feature({"AndroidWebView", "FindInPage"})
93    public void testFindAllEmptyNext() throws Throwable {
94        assertEquals(4, findAllAsyncOnUiThread("wood"));
95        assertEquals(1, findNextOnUiThread(true));
96        assertEquals(0, findAllAsyncOnUiThread(""));
97        assertEquals(0, findNextOnUiThread(true));
98        assertEquals(0, findAllAsyncOnUiThread(""));
99        assertEquals(4, findAllAsyncOnUiThread("wood"));
100        assertEquals(1, findNextOnUiThread(true));
101    }
102 
103    @SmallTest
104    @Feature({"AndroidWebView", "FindInPage"})
105    public void testClearMatches() throws Throwable {
106        assertEquals(4, findAllAsyncOnUiThread("wood"));
107        clearMatchesOnUiThread();
108    }
109 
110    @SmallTest
111    @Feature({"AndroidWebView", "FindInPage"})
112    public void testClearFindNext() throws Throwable {
113        assertEquals(4, findAllAsyncOnUiThread("wood"));
114        clearMatchesOnUiThread();
115        assertEquals(4, findAllAsyncOnUiThread("wood"));
116        assertEquals(2, findNextOnUiThread(true));
117    }
118 
119    @SmallTest
120    @Feature({"AndroidWebView", "FindInPage"})
121    public void testFindEmptyNext() throws Throwable {
122        assertEquals(0, findAllAsyncOnUiThread(""));
123        assertEquals(0, findNextOnUiThread(true));
124        assertEquals(4, findAllAsyncOnUiThread("wood"));
125    }
126 
127    @SmallTest
128    @Feature({"AndroidWebView", "FindInPage"})
129    public void testFindNextFirst() throws Throwable {
130        runTestOnUiThread(new Runnable() {
131            @Override
132            public void run() {
133                contents().findNext(true);
134            }
135        });
136        assertEquals(4, findAllAsyncOnUiThread("wood"));
137        assertEquals(1, findNextOnUiThread(true));
138        assertEquals(0, findNextOnUiThread(false));
139        assertEquals(3, findNextOnUiThread(false));
140    }
141}

[all classes][org.chromium.android_webview.test]
EMMA 2.0.5312 (C) Vladimir Roubtsov