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

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

Issue 1647803004: Move base to DEPS (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
« no previous file with comments | « base/android/jni_weak_ref.cc ('k') | base/android/junit/src/org/chromium/base/LogTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index 0aa9ccd388faa95cc93944810ed9077c06b50e1b..0000000000000000000000000000000000000000
--- a/base/android/junit/src/org/chromium/base/BaseChromiumApplicationTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.base;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import android.app.Activity;
-
-import junit.framework.Assert;
-
-import org.chromium.base.BaseChromiumApplication.WindowFocusChangedListener;
-import org.chromium.testing.local.LocalRobolectricTestRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.Robolectric;
-import org.robolectric.annotation.Config;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.shadows.ShadowActivity;
-import org.robolectric.util.ActivityController;
-
-/** Unit tests for {@link BaseChromiumApplication}. */
-@RunWith(LocalRobolectricTestRunner.class)
-@Config(manifest = Config.NONE, application = BaseChromiumApplication.class,
- shadows = {BaseChromiumApplicationTest.TrackingShadowActivity.class})
-public class BaseChromiumApplicationTest {
-
- @Implements(Activity.class)
- public static class TrackingShadowActivity extends ShadowActivity {
- private int mWindowFocusCalls;
- private int mDispatchKeyEventCalls;
- private boolean mReturnValueForKeyDispatch;
-
- @Implementation
- public void onWindowFocusChanged(@SuppressWarnings("unused") boolean hasFocus) {
- mWindowFocusCalls++;
- }
- }
-
- @Test
- public void testWindowsFocusChanged() throws Exception {
- BaseChromiumApplication app = (BaseChromiumApplication) Robolectric.application;
-
- WindowFocusChangedListener mock = mock(WindowFocusChangedListener.class);
- app.registerWindowFocusChangedListener(mock);
-
- ActivityController<Activity> controller =
- Robolectric.buildActivity(Activity.class).create().start().visible();
- TrackingShadowActivity shadow =
- (TrackingShadowActivity) Robolectric.shadowOf(controller.get());
-
- controller.get().getWindow().getCallback().onWindowFocusChanged(true);
- // Assert that listeners were notified.
- verify(mock).onWindowFocusChanged(controller.get(), true);
- // Also ensure that the original activity is forwarded the notification.
- Assert.assertEquals(1, shadow.mWindowFocusCalls);
- }
-}
« no previous file with comments | « base/android/jni_weak_ref.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