OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.ntp.cards; | 5 package org.chromium.chrome.browser.ntp.cards; |
6 | 6 |
7 import static org.junit.Assert.assertEquals; | 7 import static org.junit.Assert.assertEquals; |
8 import static org.junit.Assert.assertFalse; | 8 import static org.junit.Assert.assertFalse; |
9 import static org.junit.Assert.assertNotEquals; | 9 import static org.junit.Assert.assertNotEquals; |
10 import static org.junit.Assert.assertThat; | 10 import static org.junit.Assert.assertThat; |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 mAdapter.getFirstPositionForType(ItemViewType.ALL_DISMISSED)); | 921 mAdapter.getFirstPositionForType(ItemViewType.ALL_DISMISSED)); |
922 } | 922 } |
923 | 923 |
924 /** | 924 /** |
925 * Robolectric shadow to mock out calls to {@link Resources#getString}. | 925 * Robolectric shadow to mock out calls to {@link Resources#getString}. |
926 */ | 926 */ |
927 @Implements(Resources.class) | 927 @Implements(Resources.class) |
928 public static class MyShadowResources extends ShadowResources { | 928 public static class MyShadowResources extends ShadowResources { |
929 public static final Resources sResources = mock(Resources.class); | 929 public static final Resources sResources = mock(Resources.class); |
930 | 930 |
931 @Override | |
932 @Implementation | 931 @Implementation |
933 public CharSequence getText(int id) { | 932 public CharSequence getText(int id) { |
934 return sResources.getText(id); | 933 return sResources.getText(id); |
935 } | 934 } |
936 } | 935 } |
937 | 936 |
938 /** | 937 /** |
939 * Asserts that the given {@link TreeNode} is a {@link SuggestionsSection} t
hat matches the | 938 * Asserts that the given {@link TreeNode} is a {@link SuggestionsSection} t
hat matches the |
940 * given {@link SectionDescriptor}. | 939 * given {@link SectionDescriptor}. |
941 * @param descriptor The section descriptor to match against. | 940 * @param descriptor The section descriptor to match against. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 } | 1003 } |
1005 | 1004 |
1006 private boolean isSignInPromoVisible() { | 1005 private boolean isSignInPromoVisible() { |
1007 return mAdapter.getFirstPositionForType(ItemViewType.PROMO) != RecyclerV
iew.NO_POSITION; | 1006 return mAdapter.getFirstPositionForType(ItemViewType.PROMO) != RecyclerV
iew.NO_POSITION; |
1008 } | 1007 } |
1009 | 1008 |
1010 private int getCategory(TreeNode item) { | 1009 private int getCategory(TreeNode item) { |
1011 return ((SuggestionsSection) item).getCategory(); | 1010 return ((SuggestionsSection) item).getCategory(); |
1012 } | 1011 } |
1013 } | 1012 } |
OLD | NEW |