| 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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 mAdapter.getFirstPositionForType(ItemViewType.ALL_DISMISSED)); | 933 mAdapter.getFirstPositionForType(ItemViewType.ALL_DISMISSED)); |
| 934 } | 934 } |
| 935 | 935 |
| 936 /** | 936 /** |
| 937 * Robolectric shadow to mock out calls to {@link Resources#getString}. | 937 * Robolectric shadow to mock out calls to {@link Resources#getString}. |
| 938 */ | 938 */ |
| 939 @Implements(Resources.class) | 939 @Implements(Resources.class) |
| 940 public static class MyShadowResources extends ShadowResources { | 940 public static class MyShadowResources extends ShadowResources { |
| 941 public static final Resources sResources = mock(Resources.class); | 941 public static final Resources sResources = mock(Resources.class); |
| 942 | 942 |
| 943 @Override | |
| 944 @Implementation | 943 @Implementation |
| 945 public CharSequence getText(int id) { | 944 public CharSequence getText(int id) { |
| 946 return sResources.getText(id); | 945 return sResources.getText(id); |
| 947 } | 946 } |
| 948 } | 947 } |
| 949 | 948 |
| 950 /** | 949 /** |
| 951 * Asserts that the given {@link TreeNode} is a {@link SuggestionsSection} t
hat matches the | 950 * Asserts that the given {@link TreeNode} is a {@link SuggestionsSection} t
hat matches the |
| 952 * given {@link SectionDescriptor}. | 951 * given {@link SectionDescriptor}. |
| 953 * @param descriptor The section descriptor to match against. | 952 * @param descriptor The section descriptor to match against. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 } | 1015 } |
| 1017 | 1016 |
| 1018 private boolean isSignInPromoVisible() { | 1017 private boolean isSignInPromoVisible() { |
| 1019 return mAdapter.getFirstPositionForType(ItemViewType.PROMO) != RecyclerV
iew.NO_POSITION; | 1018 return mAdapter.getFirstPositionForType(ItemViewType.PROMO) != RecyclerV
iew.NO_POSITION; |
| 1020 } | 1019 } |
| 1021 | 1020 |
| 1022 private int getCategory(TreeNode item) { | 1021 private int getCategory(TreeNode item) { |
| 1023 return ((SuggestionsSection) item).getCategory(); | 1022 return ((SuggestionsSection) item).getCategory(); |
| 1024 } | 1023 } |
| 1025 } | 1024 } |
| OLD | NEW |