| name | class, % | method, % | block, % | line, % |
|---|
| | | | | |
| class AwTestContainerView$1 | 0% (0/1) | 100% (0/0) | 100% (0/0) | 100% (0/0) |
| | | | | |
| class AwTestContainerView$InternalAccessAdapter | 100% (1/1) | 44% (7/16) | 45% (42/93) | 45% (9/20) |
| awakenScrollBars (): boolean | | 0% (0/1) | 0% (0/4) | 0% (0/1) |
| drawChild (Canvas, View, long): boolean | | 0% (0/1) | 0% (0/7) | 0% (0/1) |
| onScrollChanged (int, int, int, int): void | | 0% (0/1) | 0% (0/8) | 0% (0/2) |
| super_awakenScrollBars (int, boolean): boolean | | 0% (0/1) | 0% (0/6) | 0% (0/1) |
| super_dispatchKeyEvent (KeyEvent): boolean | | 0% (0/1) | 0% (0/5) | 0% (0/1) |
| super_dispatchKeyEventPreIme (KeyEvent): boolean | | 0% (0/1) | 0% (0/5) | 0% (0/1) |
| super_onConfigurationChanged (Configuration): void | | 0% (0/1) | 0% (0/5) | 0% (0/2) |
| super_onGenericMotionEvent (MotionEvent): boolean | | 0% (0/1) | 0% (0/5) | 0% (0/1) |
| super_onKeyUp (int, KeyEvent): boolean | | 0% (0/1) | 0% (0/6) | 0% (0/1) |
| AwTestContainerView$InternalAccessAdapter (AwTestContainerView): void | | 100% (1/1) | 100% (6/6) | 100% (1/1) |
| AwTestContainerView$InternalAccessAdapter (AwTestContainerView, AwTestContain... | | 100% (1/1) | 100% (4/4) | 100% (1/1) |
| overScrollBy (int, int, int, int, int, int, int, int, boolean): void | | 100% (1/1) | 100% (14/14) | 100% (2/2) |
| requestDrawGL (Canvas): boolean | | 100% (1/1) | 100% (2/2) | 100% (1/1) |
| setMeasuredDimension (int, int): void | | 100% (1/1) | 100% (6/6) | 100% (2/2) |
| super_getScrollBarStyle (): int | | 100% (1/1) | 100% (4/4) | 100% (1/1) |
| super_scrollTo (int, int): void | | 100% (1/1) | 100% (6/6) | 100% (2/2) |
| | | | | |
| class AwTestContainerView | 100% (1/1) | 62% (21/34) | 71% (161/226) | 85% (43.3/51) |
| access$1001 (AwTestContainerView, int, boolean): boolean | | 0% (0/1) | 0% (0/5) | 0% (0/1) |
| access$101 (AwTestContainerView, Canvas, View, long): boolean | | 0% (0/1) | 0% (0/6) | 0% (0/1) |
| access$201 (AwTestContainerView, int, KeyEvent): boolean | | 0% (0/1) | 0% (0/5) | 0% (0/1) |
| access$301 (AwTestContainerView, KeyEvent): boolean | | 0% (0/1) | 0% (0/4) | 0% (0/1) |
| access$401 (AwTestContainerView, KeyEvent): boolean | | 0% (0/1) | 0% (0/4) | 0% (0/1) |
| access$501 (AwTestContainerView, MotionEvent): boolean | | 0% (0/1) | 0% (0/4) | 0% (0/1) |
| access$601 (AwTestContainerView, Configuration): void | | 0% (0/1) | 0% (0/4) | 0% (0/1) |
| access$801 (AwTestContainerView, int, int, int, int): void | | 0% (0/1) | 0% (0/7) | 0% (0/1) |
| access$901 (AwTestContainerView): boolean | | 0% (0/1) | 0% (0/3) | 0% (0/1) |
| destroy (): void | | 0% (0/1) | 0% (0/4) | 0% (0/2) |
| dispatchKeyEvent (KeyEvent): boolean | | 0% (0/1) | 0% (0/5) | 0% (0/1) |
| onConfigurationChanged (Configuration): void | | 0% (0/1) | 0% (0/8) | 0% (0/3) |
| onKeyUp (int, KeyEvent): boolean | | 0% (0/1) | 0% (0/6) | 0% (0/1) |
| AwTestContainerView (Context): void | | 100% (1/1) | 100% (14/14) | 100% (4/4) |
| access$1101 (AwTestContainerView, int, int): void | | 100% (1/1) | 100% (5/5) | 100% (1/1) |
| access$1201 (AwTestContainerView): int | | 100% (1/1) | 100% (3/3) | 100% (1/1) |
| access$700 (AwTestContainerView, int, int, int, int, int, int, int, int, bool... | | 100% (1/1) | 100% (12/12) | 100% (1/1) |
| computeScroll (): void | | 100% (1/1) | 100% (4/4) | 100% (2/2) |
| getAwContents (): AwContents | | 100% (1/1) | 100% (3/3) | 100% (1/1) |
| getContentViewCore (): ContentViewCore | | 100% (1/1) | 100% (4/4) | 100% (1/1) |
| getInternalAccessDelegate (): AwContents$InternalAccessDelegate | | 100% (1/1) | 100% (3/3) | 100% (1/1) |
| initialize (AwContents): void | | 100% (1/1) | 100% (4/4) | 100% (2/2) |
| onAttachedToWindow (): void | | 100% (1/1) | 100% (6/6) | 100% (3/3) |
| onCreateInputConnection (EditorInfo): InputConnection | | 100% (1/1) | 100% (5/5) | 100% (1/1) |
| onDetachedFromWindow (): void | | 100% (1/1) | 100% (6/6) | 100% (3/3) |
| onDraw (Canvas): void | | 100% (1/1) | 100% (8/8) | 100% (3/3) |
| onFocusChanged (boolean, int, Rect): void | | 100% (1/1) | 100% (12/12) | 100% (3/3) |
| onMeasure (int, int): void | | 100% (1/1) | 100% (6/6) | 100% (2/2) |
| onOverScrolled (int, int, boolean, boolean): void | | 100% (1/1) | 100% (8/8) | 100% (2/2) |
| onScrollChanged (int, int, int, int): void | | 100% (1/1) | 100% (17/17) | 100% (4/4) |
| onSizeChanged (int, int, int, int): void | | 100% (1/1) | 100% (14/14) | 100% (3/3) |
| onTouchEvent (MotionEvent): boolean | | 100% (1/1) | 100% (9/9) | 100% (2/2) |
| onVisibilityChanged (View, int): void | | 100% (1/1) | 100% (10/10) | 100% (3/3) |
| onWindowVisibilityChanged (int): void | | 100% (1/1) | 100% (8/8) | 100% (3/3) |
| 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 | |
| 5 | package org.chromium.android_webview.test; |
| 6 | |
| 7 | import android.content.Context; |
| 8 | import android.content.res.Configuration; |
| 9 | import android.graphics.Canvas; |
| 10 | import android.graphics.Rect; |
| 11 | import android.view.KeyEvent; |
| 12 | import android.view.MotionEvent; |
| 13 | import android.view.View; |
| 14 | import android.view.ViewGroup; |
| 15 | import android.view.inputmethod.EditorInfo; |
| 16 | import android.view.inputmethod.InputConnection; |
| 17 | import android.widget.FrameLayout; |
| 18 | import android.util.Log; |
| 19 | |
| 20 | import org.chromium.android_webview.AwContents; |
| 21 | import org.chromium.content.browser.ContentViewCore; |
| 22 | |
| 23 | /** |
| 24 | * A View used for testing the AwContents internals. |
| 25 | * |
| 26 | * This class takes the place android.webkit.WebView would have in the production configuration. |
| 27 | */ |
| 28 | public class AwTestContainerView extends FrameLayout { |
| 29 | private AwContents mAwContents; |
| 30 | private AwContents.InternalAccessDelegate mInternalAccessDelegate; |
| 31 | |
| 32 | public AwTestContainerView(Context context) { |
| 33 | super(context); |
| 34 | mInternalAccessDelegate = new InternalAccessAdapter(); |
| 35 | setOverScrollMode(View.OVER_SCROLL_ALWAYS); |
| 36 | } |
| 37 | |
| 38 | public void initialize(AwContents awContents) { |
| 39 | mAwContents = awContents; |
| 40 | } |
| 41 | |
| 42 | public ContentViewCore getContentViewCore() { |
| 43 | return mAwContents.getContentViewCore(); |
| 44 | } |
| 45 | |
| 46 | public AwContents getAwContents() { |
| 47 | return mAwContents; |
| 48 | } |
| 49 | |
| 50 | public AwContents.InternalAccessDelegate getInternalAccessDelegate() { |
| 51 | return mInternalAccessDelegate; |
| 52 | } |
| 53 | |
| 54 | public void destroy() { |
| 55 | mAwContents.destroy(); |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | public void onConfigurationChanged(Configuration newConfig) { |
| 60 | super.onConfigurationChanged(newConfig); |
| 61 | mAwContents.onConfigurationChanged(newConfig); |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public void onAttachedToWindow() { |
| 66 | super.onAttachedToWindow(); |
| 67 | mAwContents.onAttachedToWindow(); |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public void onDetachedFromWindow() { |
| 72 | super.onDetachedFromWindow(); |
| 73 | mAwContents.onDetachedFromWindow(); |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { |
| 78 | super.onFocusChanged(focused, direction, previouslyFocusedRect); |
| 79 | mAwContents.onFocusChanged(focused, direction, previouslyFocusedRect); |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public InputConnection onCreateInputConnection(EditorInfo outAttrs) { |
| 84 | return mAwContents.onCreateInputConnection(outAttrs); |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public boolean onKeyUp(int keyCode, KeyEvent event) { |
| 89 | return mAwContents.onKeyUp(keyCode, event); |
| 90 | } |
| 91 | |
| 92 | @Override |
| 93 | public boolean dispatchKeyEvent(KeyEvent event) { |
| 94 | return mAwContents.dispatchKeyEvent(event); |
| 95 | } |
| 96 | |
| 97 | @Override |
| 98 | public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| 99 | mAwContents.onMeasure(widthMeasureSpec, heightMeasureSpec); |
| 100 | } |
| 101 | |
| 102 | @Override |
| 103 | public void onSizeChanged(int w, int h, int ow, int oh) { |
| 104 | super.onSizeChanged(w, h, ow, oh); |
| 105 | mAwContents.onSizeChanged(w, h, ow, oh); |
| 106 | } |
| 107 | |
| 108 | @Override |
| 109 | public void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) { |
| 110 | mAwContents.onContainerViewOverScrolled(scrollX, scrollY, clampedX, clampedY); |
| 111 | } |
| 112 | |
| 113 | @Override |
| 114 | public void onScrollChanged(int l, int t, int oldl, int oldt) { |
| 115 | super.onScrollChanged(l, t, oldl, oldt); |
| 116 | if (mAwContents != null) { |
| 117 | mAwContents.onContainerViewScrollChanged(l, t, oldl, oldt); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | @Override |
| 122 | public void computeScroll() { |
| 123 | mAwContents.computeScroll(); |
| 124 | } |
| 125 | |
| 126 | @Override |
| 127 | public void onVisibilityChanged(View changedView, int visibility) { |
| 128 | super.onVisibilityChanged(changedView, visibility); |
| 129 | mAwContents.onVisibilityChanged(changedView, visibility); |
| 130 | } |
| 131 | |
| 132 | @Override |
| 133 | public void onWindowVisibilityChanged(int visibility) { |
| 134 | super.onWindowVisibilityChanged(visibility); |
| 135 | mAwContents.onWindowVisibilityChanged(visibility); |
| 136 | } |
| 137 | |
| 138 | @Override |
| 139 | public boolean onTouchEvent(MotionEvent ev) { |
| 140 | super.onTouchEvent(ev); |
| 141 | return mAwContents.onTouchEvent(ev); |
| 142 | } |
| 143 | |
| 144 | @Override |
| 145 | public void onDraw(Canvas canvas) { |
| 146 | mAwContents.onDraw(canvas); |
| 147 | super.onDraw(canvas); |
| 148 | } |
| 149 | |
| 150 | // TODO: AwContents could define a generic class that holds an implementation similar to |
| 151 | // the one below. |
| 152 | private class InternalAccessAdapter implements AwContents.InternalAccessDelegate { |
| 153 | |
| 154 | @Override |
| 155 | public boolean drawChild(Canvas canvas, View child, long drawingTime) { |
| 156 | return AwTestContainerView.super.drawChild(canvas, child, drawingTime); |
| 157 | } |
| 158 | |
| 159 | @Override |
| 160 | public boolean super_onKeyUp(int keyCode, KeyEvent event) { |
| 161 | return AwTestContainerView.super.onKeyUp(keyCode, event); |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public boolean super_dispatchKeyEventPreIme(KeyEvent event) { |
| 166 | return AwTestContainerView.super.dispatchKeyEventPreIme(event); |
| 167 | } |
| 168 | |
| 169 | @Override |
| 170 | public boolean super_dispatchKeyEvent(KeyEvent event) { |
| 171 | return AwTestContainerView.super.dispatchKeyEvent(event); |
| 172 | } |
| 173 | |
| 174 | @Override |
| 175 | public boolean super_onGenericMotionEvent(MotionEvent event) { |
| 176 | return AwTestContainerView.super.onGenericMotionEvent(event); |
| 177 | } |
| 178 | |
| 179 | @Override |
| 180 | public void super_onConfigurationChanged(Configuration newConfig) { |
| 181 | AwTestContainerView.super.onConfigurationChanged(newConfig); |
| 182 | } |
| 183 | |
| 184 | @Override |
| 185 | public void super_scrollTo(int scrollX, int scrollY) { |
| 186 | // We're intentionally not calling super.scrollTo here to make testing easier. |
| 187 | AwTestContainerView.this.scrollTo(scrollX, scrollY); |
| 188 | } |
| 189 | |
| 190 | @Override |
| 191 | public void overScrollBy(int deltaX, int deltaY, |
| 192 | int scrollX, int scrollY, |
| 193 | int scrollRangeX, int scrollRangeY, |
| 194 | int maxOverScrollX, int maxOverScrollY, |
| 195 | boolean isTouchEvent) { |
| 196 | // We're intentionally not calling super.scrollTo here to make testing easier. |
| 197 | AwTestContainerView.this.overScrollBy(deltaX, deltaY, scrollX, scrollY, |
| 198 | scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); |
| 199 | } |
| 200 | |
| 201 | @Override |
| 202 | public void onScrollChanged(int l, int t, int oldl, int oldt) { |
| 203 | AwTestContainerView.super.onScrollChanged(l, t, oldl, oldt); |
| 204 | } |
| 205 | |
| 206 | @Override |
| 207 | public boolean awakenScrollBars() { |
| 208 | return AwTestContainerView.super.awakenScrollBars(); |
| 209 | } |
| 210 | |
| 211 | @Override |
| 212 | public boolean super_awakenScrollBars(int startDelay, boolean invalidate) { |
| 213 | return AwTestContainerView.super.awakenScrollBars(startDelay, invalidate); |
| 214 | } |
| 215 | |
| 216 | @Override |
| 217 | public void setMeasuredDimension(int measuredWidth, int measuredHeight) { |
| 218 | AwTestContainerView.super.setMeasuredDimension(measuredWidth, measuredHeight); |
| 219 | } |
| 220 | |
| 221 | @Override |
| 222 | public int super_getScrollBarStyle() { |
| 223 | return AwTestContainerView.super.getScrollBarStyle(); |
| 224 | } |
| 225 | |
| 226 | @Override |
| 227 | public boolean requestDrawGL(Canvas canvas) { |
| 228 | return false; |
| 229 | } |
| 230 | } |
| 231 | } |