EMMA Coverage Report (generated Fri Aug 23 16:39:17 PDT 2013)
[all classes][org.chromium.content.browser.test.util]

COVERAGE SUMMARY FOR SOURCE FILE [TestInputMethodManagerWrapper.java]

nameclass, %method, %block, %line, %
TestInputMethodManagerWrapper.java100% (1/1)100% (8/8)76%  (55/72)82%  (16.4/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TestInputMethodManagerWrapper100% (1/1)100% (8/8)76%  (55/72)82%  (16.4/20)
showSoftInput (View, int, ResultReceiver): void 100% (1/1)43%  (10/23)40%  (2/5)
isActive (View): boolean 100% (1/1)71%  (5/7)80%  (1.6/2)
hideSoftInputFromWindow (IBinder, int, ResultReceiver): boolean 100% (1/1)83%  (10/12)94%  (2.8/3)
TestInputMethodManagerWrapper (ContentViewCore): void 100% (1/1)100% (10/10)100% (4/4)
getEditorInfo (): EditorInfo 100% (1/1)100% (3/3)100% (1/1)
getShowSoftInputCounter (): int 100% (1/1)100% (3/3)100% (1/1)
restartInput (View): void 100% (1/1)100% (13/13)100% (3/3)
updateSelection (View, int, int, int, int): void 100% (1/1)100% (1/1)100% (1/1)

1// Copyright 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 
5package org.chromium.content.browser.test.util;
6 
7import android.os.IBinder;
8import android.os.ResultReceiver;
9import android.view.inputmethod.EditorInfo;
10import android.view.inputmethod.InputConnection;
11import android.view.View;
12 
13import org.chromium.content.browser.ContentViewCore;
14import org.chromium.content.browser.input.InputMethodManagerWrapper;
15 
16public class TestInputMethodManagerWrapper extends InputMethodManagerWrapper {
17    private ContentViewCore mContentViewCore;
18    private InputConnection mInputConnection;
19    private int mShowSoftInputCounter = 0;
20    private EditorInfo mEditorInfo;
21 
22    public TestInputMethodManagerWrapper(ContentViewCore contentViewCore) {
23        super(null);
24        mContentViewCore = contentViewCore;
25    }
26 
27    @Override
28    public void restartInput(View view) {
29        mEditorInfo = new EditorInfo();
30        mInputConnection = mContentViewCore.onCreateInputConnection(mEditorInfo);
31    }
32 
33    @Override
34    public void showSoftInput(View view, int flags, ResultReceiver resultReceiver) {
35        mShowSoftInputCounter++;
36        if (mInputConnection != null) return;
37        mEditorInfo = new EditorInfo();
38        mInputConnection = mContentViewCore.onCreateInputConnection(mEditorInfo);
39    }
40 
41    @Override
42    public boolean isActive(View view) {
43        if (mInputConnection == null) return false;
44        return true;
45    }
46 
47    @Override
48    public boolean hideSoftInputFromWindow(IBinder windowToken, int flags,
49            ResultReceiver resultReceiver) {
50        boolean retVal = mInputConnection == null;
51        mInputConnection = null;
52        return retVal;
53    }
54 
55    @Override
56    public void updateSelection(View view, int selStart, int selEnd,
57            int candidatesStart, int candidatesEnd) {
58    }
59 
60    public int getShowSoftInputCounter() {
61        return mShowSoftInputCounter;
62    }
63 
64    public EditorInfo getEditorInfo() {
65        return mEditorInfo;
66    }
67}
68 

[all classes][org.chromium.content.browser.test.util]
EMMA 2.0.5312 (C) Vladimir Roubtsov