diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/dialer/calllog/CallLogAdapterTest.java | 3 | ||||
-rw-r--r-- | tests/src/com/android/dialer/widget/ActionBarControllerTest.java | 39 |
2 files changed, 38 insertions, 4 deletions
diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index b7f06d31c..9b3e6bcc4 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -21,6 +21,7 @@ import android.database.MatrixCursor; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.view.View; +import android.widget.LinearLayout; import com.google.common.collect.Lists; @@ -68,7 +69,7 @@ public class CallLogAdapterTest extends AndroidTestCase { mCursor = new MatrixCursor(CallLogQuery._PROJECTION); mCursor.moveToFirst(); // The views into which to store the data. - mView = new CallLogListItemView(getContext()); + mView = new LinearLayout(getContext()); mView.setTag(CallLogListItemViews.createForTest(getContext())); } diff --git a/tests/src/com/android/dialer/widget/ActionBarControllerTest.java b/tests/src/com/android/dialer/widget/ActionBarControllerTest.java index cafa747f2..2e388380f 100644 --- a/tests/src/com/android/dialer/widget/ActionBarControllerTest.java +++ b/tests/src/com/android/dialer/widget/ActionBarControllerTest.java @@ -17,25 +17,53 @@ package com.android.dialer.widget; import android.app.ActionBar; +import android.app.Activity; import android.content.Context; +import android.test.ActivityInstrumentationTestCase2; +import android.test.AndroidTestCase; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; +import android.view.View; +import com.android.dialer.DialtactsActivity; import com.android.dialer.widget.ActionBarController.ActivityUi; +import com.android.internal.app.WindowDecorActionBar; @SmallTest -public class ActionBarControllerTest extends InstrumentationTestCase { +public class ActionBarControllerTest extends ActivityInstrumentationTestCase2<DialtactsActivity> { private static final int ACTION_BAR_HEIGHT = 100; private ActionBarController mActionBarController; private SearchEditTextLayout mSearchBox; private MockActivityUi mActivityUi; + private class MockActionBar extends WindowDecorActionBar { + private int mHideOffset = 0; + + public MockActionBar(Activity activity) { + super(activity); + } + + @Override + public void setHideOffset(int offset) { + mHideOffset = offset; + } + + @Override + public int getHideOffset() { + return mHideOffset; + } + } + private class MockActivityUi implements ActivityUi { boolean isInSearchUi; boolean hasSearchQuery; boolean shouldShowActionBar; - int actionBarHideOffset; + private ActionBar mActionBar; + + public MockActivityUi() { + mActionBar = new MockActionBar(getActivity()); + } @Override public boolean isInSearchUi() { @@ -59,7 +87,7 @@ public class ActionBarControllerTest extends InstrumentationTestCase { @Override public ActionBar getActionBar() { - return null; + return mActionBar; } } @@ -83,6 +111,11 @@ public class ActionBarControllerTest extends InstrumentationTestCase { } } + public ActionBarControllerTest() { + super(DialtactsActivity.class); + } + + @Override protected void setUp() { mActivityUi = new MockActivityUi(); |