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

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowResources.java

Issue 2816603002: Adding JUnit tests for MediaNotificationManager (Closed)
Patch Set: rebased Created 3 years, 8 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 | « chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowNotificationManager.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowResources.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowResources.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowResources.java
new file mode 100644
index 0000000000000000000000000000000000000000..7febe4442deccbd874b2dae92289c0d07ed762ed
--- /dev/null
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowResources.java
@@ -0,0 +1,39 @@
+// Copyright 2017 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.chrome.browser.media.ui;
+
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
+import android.content.res.Resources;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.shadows.ShadowResources;
+
+/**
+ * Dummy Robolectric shadow for Android Resources for MediaNotification tests.
+ */
+@Implements(Resources.class)
+public class MediaNotificationTestShadowResources extends ShadowResources {
+ public static final Resources sResources;
+
+ static {
+ sResources = mock(Resources.class);
+ doReturn("mocked text").when(sResources).getText(anyInt());
+ doReturn("mocked resource name").when(sResources).getResourceName(anyInt());
+ }
+
+ @Implementation
+ public CharSequence getText(int id) {
+ return sResources.getText(id);
+ }
+
+ @Implementation
+ public CharSequence getResourceName(int id) {
+ return sResources.getResourceName(id);
+ }
+}
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowNotificationManager.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698