Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleTest.java

Issue 2342453003: [NTP] Fix article suggestion clicks contributing to Most Visited tiles (Closed)
Patch Set: Added TODO as suggested. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698