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

Unified Diff: base/android/junit/src/org/chromium/base/BaseChromiumApplicationTest.java

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: base/android/junit/src/org/chromium/base/BaseChromiumApplicationTest.java
diff --git a/base/android/junit/src/org/chromium/base/BaseChromiumApplicationTest.java b/base/android/junit/src/org/chromium/base/BaseChromiumApplicationTest.java
index d3441f7895fed53357bb427c05a25cb8cd42eac5..0aa9ccd388faa95cc93944810ed9077c06b50e1b 100644
--- a/base/android/junit/src/org/chromium/base/BaseChromiumApplicationTest.java
+++ b/base/android/junit/src/org/chromium/base/BaseChromiumApplicationTest.java
@@ -8,7 +8,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import android.app.Activity;
-import android.view.KeyEvent;
import junit.framework.Assert;
@@ -39,12 +38,6 @@ public class BaseChromiumApplicationTest {
public void onWindowFocusChanged(@SuppressWarnings("unused") boolean hasFocus) {
mWindowFocusCalls++;
}
-
- @Implementation
- public boolean dispatchKeyEvent(@SuppressWarnings("unused") KeyEvent event) {
- mDispatchKeyEventCalls++;
- return mReturnValueForKeyDispatch;
- }
}
@Test
@@ -65,30 +58,4 @@ public class BaseChromiumApplicationTest {
// Also ensure that the original activity is forwarded the notification.
Assert.assertEquals(1, shadow.mWindowFocusCalls);
}
-
- @Test
- public void testDispatchKeyEvent() throws Exception {
- ActivityController<Activity> controller =
- Robolectric.buildActivity(Activity.class).create().start().visible();
- TrackingShadowActivity shadow =
- (TrackingShadowActivity) Robolectric.shadowOf(controller.get());
-
- final KeyEvent menuKey = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MENU);
-
- // Ensure that key events are forwarded.
- Assert.assertFalse(controller.get().getWindow().getCallback().dispatchKeyEvent(menuKey));
- // This gets called twice - once to see if the activity is swallowing it, and again to
- // dispatch it.
- Assert.assertEquals(2, shadow.mDispatchKeyEventCalls);
-
- // Ensure that our activity can swallow the event.
- shadow.mReturnValueForKeyDispatch = true;
- Assert.assertTrue(controller.get().getWindow().getCallback().dispatchKeyEvent(menuKey));
- Assert.assertEquals(3, shadow.mDispatchKeyEventCalls);
-
- // A non-enter key only dispatches once.
- Assert.assertTrue(controller.get().getWindow().getCallback().dispatchKeyEvent(
- new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SPACE)));
- Assert.assertEquals(4, shadow.mDispatchKeyEventCalls);
- }
}
« no previous file with comments | « base/android/jni_generator/sample_for_tests.cc ('k') | base/android/junit/src/org/chromium/base/LogTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698