OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.ntp.snippets; |
| 6 |
| 7 import static org.junit.Assert.assertEquals; |
| 8 |
| 9 import org.junit.Test; |
| 10 import org.junit.runner.RunWith; |
| 11 import org.junit.runners.JUnit4; |
| 12 |
| 13 /** |
| 14 * Unit tests for SnippetArticle. |
| 15 */ |
| 16 @RunWith(JUnit4.class) |
| 17 public class SnippetArticleTest { |
| 18 @Test |
| 19 public void testBookmarkUrl() { |
| 20 SnippetArticle snippet = new SnippetArticle(KnownCategories.BOOKMARKS, "
id1", "Bookmark", |
| 21 "", "Preview Text", "http://www.google.com", |
| 22 "", // AMP URL |
| 23 1466614774, // Timestamp |
| 24 10f, // Score |
| 25 0, // Position |
| 26 ContentSuggestionsCardLayout.FULL_CARD); |
| 27 assertEquals("http://www.google.com", snippet.getPossiblyWrappedUrl()); |
| 28 } |
| 29 |
| 30 @Test |
| 31 public void testArticleSuggestionUrl() { |
| 32 SnippetArticle snippet = new SnippetArticle(KnownCategories.ARTICLES, "i
d1", |
| 33 "Article suggestion", "Publisher", "Preview Text", "http://www.g
oogle.com", |
| 34 "", // AMP URL |
| 35 1466614774, // Timestamp |
| 36 10f, // Score |
| 37 0, // Position |
| 38 ContentSuggestionsCardLayout.FULL_CARD); |
| 39 assertEquals("data:text/html;utf-8,%3Chead%3E%3Cmeta%20http-equiv%3D%22r
efresh%22%20content" |
| 40 + "%3D%220%3B%20url%3Dhttp%3A%2F%2Fwww.google.com%22%3E%
3C%2Fhead%3E", |
| 41 snippet.getPossiblyWrappedUrl()); |
| 42 } |
| 43 } |
OLD | NEW |