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

Unified Diff: javatests/org/chromium/distiller/webdocument/WebImageTest.java

Issue 2203563002: Extract image URLs in srcset as well (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: format Created 4 years, 5 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
« no previous file with comments | « javatests/org/chromium/distiller/DomUtilTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: javatests/org/chromium/distiller/webdocument/WebImageTest.java
diff --git a/javatests/org/chromium/distiller/webdocument/WebImageTest.java b/javatests/org/chromium/distiller/webdocument/WebImageTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..406db952989789ee01224e68be3a402831ef3186
--- /dev/null
+++ b/javatests/org/chromium/distiller/webdocument/WebImageTest.java
@@ -0,0 +1,27 @@
+// 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.distiller.webdocument;
+
+import org.chromium.distiller.DomDistillerJsTestCase;
+
+import java.util.List;
+
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.ImageElement;
+
+public class WebImageTest extends DomDistillerJsTestCase {
+ public void testGetSrcList() {
+ ImageElement img = Document.get().createImageElement();
+ img.setSrc("http://example.com/image");
+ img.setAttribute("srcset",
+ "http://example.com/image200 200w, http://example.com/image400 400w");
+ WebImage wi = new WebImage(img, 1, 1, img.getSrc());
+ List<String> urls = wi.getUrlList();
+ assertEquals(3, urls.size());
+ assertEquals("http://example.com/image", urls.get(0));
+ assertEquals("http://example.com/image200", urls.get(1));
+ assertEquals("http://example.com/image400", urls.get(2));
+ }
+}
« no previous file with comments | « javatests/org/chromium/distiller/DomUtilTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698