| 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 android.support.test.filters.MediumTest; | 7 import android.support.test.filters.MediumTest; |
| 8 import android.support.v7.widget.RecyclerView; | 8 import android.support.v7.widget.RecyclerView; |
| 9 import android.support.v7.widget.RecyclerView.ViewHolder; | 9 import android.support.v7.widget.RecyclerView.ViewHolder; |
| 10 import android.view.View; | 10 import android.view.View; |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 294 } |
| 295 }); | 295 }); |
| 296 waitForStableRecyclerView(); | 296 waitForStableRecyclerView(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 private List<SnippetArticle> buildSuggestions(int suggestionsCount) { | 299 private List<SnippetArticle> buildSuggestions(int suggestionsCount) { |
| 300 List<SnippetArticle> suggestions = new ArrayList<>(); | 300 List<SnippetArticle> suggestions = new ArrayList<>(); |
| 301 for (int i = 0; i < suggestionsCount; i++) { | 301 for (int i = 0; i < suggestionsCount; i++) { |
| 302 String url = mTestServer.getURL(TEST_PAGE) + "#" + i; | 302 String url = mTestServer.getURL(TEST_PAGE) + "#" + i; |
| 303 suggestions.add(new SnippetArticle(KnownCategories.ARTICLES, "id" +
i, "title" + i, | 303 suggestions.add(new SnippetArticle(KnownCategories.ARTICLES, "id" +
i, "title" + i, |
| 304 "publisher" + i, "previewText" + i, url, 1466614774 + i, 10f
, 0)); | 304 "publisher" + i, "previewText" + i, url, 1466614774 + i, 10f
)); |
| 305 } | 305 } |
| 306 return suggestions; | 306 return suggestions; |
| 307 } | 307 } |
| 308 | 308 |
| 309 private void invokeContextMenu(View view, int contextMenuItemId) { | 309 private void invokeContextMenu(View view, int contextMenuItemId) { |
| 310 TestTouchUtils.longClickView(getInstrumentation(), view); | 310 TestTouchUtils.longClickView(getInstrumentation(), view); |
| 311 assertTrue( | 311 assertTrue( |
| 312 getInstrumentation().invokeContextMenuAction(getActivity(), cont
extMenuItemId, 0)); | 312 getInstrumentation().invokeContextMenuAction(getActivity(), cont
extMenuItemId, 0)); |
| 313 } | 313 } |
| 314 | 314 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 385 |
| 386 return true; | 386 return true; |
| 387 } | 387 } |
| 388 }); | 388 }); |
| 389 } | 389 } |
| 390 | 390 |
| 391 private static void assertArrayEquals(int[] expected, int[] actual) { | 391 private static void assertArrayEquals(int[] expected, int[] actual) { |
| 392 assertEquals(Arrays.toString(expected), Arrays.toString(actual)); | 392 assertEquals(Arrays.toString(expected), Arrays.toString(actual)); |
| 393 } | 393 } |
| 394 } | 394 } |
| OLD | NEW |