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.distiller.webdocument; |
| 6 |
| 7 import org.chromium.distiller.DomDistillerJsTestCase; |
| 8 |
| 9 import java.util.List; |
| 10 |
| 11 import com.google.gwt.dom.client.Document; |
| 12 import com.google.gwt.dom.client.ImageElement; |
| 13 |
| 14 public class WebImageTest extends DomDistillerJsTestCase { |
| 15 public void testGetSrcList() { |
| 16 ImageElement img = Document.get().createImageElement(); |
| 17 img.setSrc("http://example.com/image"); |
| 18 img.setAttribute("srcset", |
| 19 "http://example.com/image200 200w, http://example.com/image400 4
00w"); |
| 20 WebImage wi = new WebImage(img, 1, 1, img.getSrc()); |
| 21 List<String> urls = wi.getUrlList(); |
| 22 assertEquals(3, urls.size()); |
| 23 assertEquals("http://example.com/image", urls.get(0)); |
| 24 assertEquals("http://example.com/image200", urls.get(1)); |
| 25 assertEquals("http://example.com/image400", urls.get(2)); |
| 26 } |
| 27 } |
OLD | NEW |