| Index: chrome/android/junit/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleTest.java
|
| diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleTest.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f95ec6c2c5dfa905b05bbb447dea6faffac51071
|
| --- /dev/null
|
| +++ b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleTest.java
|
| @@ -0,0 +1,43 @@
|
| +// Copyright 2016 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.ntp.snippets;
|
| +
|
| +import static org.junit.Assert.assertEquals;
|
| +
|
| +import org.junit.Test;
|
| +import org.junit.runner.RunWith;
|
| +import org.junit.runners.JUnit4;
|
| +
|
| +/**
|
| + * Unit tests for SnippetArticle.
|
| + */
|
| +@RunWith(JUnit4.class)
|
| +public class SnippetArticleTest {
|
| + @Test
|
| + public void testBookmarkUrl() {
|
| + SnippetArticle snippet = new SnippetArticle(KnownCategories.BOOKMARKS, "id1", "Bookmark",
|
| + "", "Preview Text", "http://www.google.com",
|
| + "", // AMP URL
|
| + 1466614774, // Timestamp
|
| + 10f, // Score
|
| + 0, // Position
|
| + ContentSuggestionsCardLayout.FULL_CARD);
|
| + assertEquals("http://www.google.com", snippet.getPossiblyWrappedUrl());
|
| + }
|
| +
|
| + @Test
|
| + public void testArticleSuggestionUrl() {
|
| + SnippetArticle snippet = new SnippetArticle(KnownCategories.ARTICLES, "id1",
|
| + "Article suggestion", "Publisher", "Preview Text", "http://www.google.com",
|
| + "", // AMP URL
|
| + 1466614774, // Timestamp
|
| + 10f, // Score
|
| + 0, // Position
|
| + ContentSuggestionsCardLayout.FULL_CARD);
|
| + assertEquals("data:text/html;utf-8,%3Chead%3E%3Cmeta%20http-equiv%3D%22refresh%22%20content"
|
| + + "%3D%220%3B%20url%3Dhttp%3A%2F%2Fwww.google.com%22%3E%3C%2Fhead%3E",
|
| + snippet.getPossiblyWrappedUrl());
|
| + }
|
| +}
|
|
|