| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.distiller; | 5 package org.chromium.distiller; |
| 6 | 6 |
| 7 import org.chromium.distiller.webdocument.WebEmbed; | 7 import org.chromium.distiller.webdocument.WebEmbed; |
| 8 import org.chromium.distiller.extractors.embeds.EmbedExtractor; | 8 import org.chromium.distiller.extractors.embeds.EmbedExtractor; |
| 9 import org.chromium.distiller.extractors.embeds.TwitterExtractor; | 9 import org.chromium.distiller.extractors.embeds.TwitterExtractor; |
| 10 import org.chromium.distiller.extractors.embeds.VimeoExtractor; | 10 import org.chromium.distiller.extractors.embeds.VimeoExtractor; |
| 11 import org.chromium.distiller.extractors.embeds.YouTubeExtractor; | 11 import org.chromium.distiller.extractors.embeds.YouTubeExtractor; |
| 12 | 12 |
| 13 import com.google.gwt.dom.client.Document; | 13 import com.google.gwt.dom.client.Document; |
| 14 import com.google.gwt.dom.client.Element; | 14 import com.google.gwt.dom.client.Element; |
| 15 import com.google.gwt.dom.client.IFrameElement; | 15 import com.google.gwt.dom.client.IFrameElement; |
| 16 | 16 |
| 17 import java.util.List; | |
| 18 | |
| 19 public class EmbedExtractorTest extends DomDistillerJsTestCase { | 17 public class EmbedExtractorTest extends DomDistillerJsTestCase { |
| 20 | 18 |
| 21 public void testYouTubeExtractor() { | 19 public void testYouTubeExtractor() { |
| 22 Element youtube = TestUtil.createIframe(); | 20 Element youtube = TestUtil.createIframe(); |
| 23 youtube.setAttribute("src", "http://www.youtube.com/embed/M7lc1UVf-VE?au
toplay=1"); | 21 youtube.setAttribute("src", "http://www.youtube.com/embed/M7lc1UVf-VE?au
toplay=1"); |
| 24 | 22 |
| 25 EmbedExtractor extractor = new YouTubeExtractor(); | 23 EmbedExtractor extractor = new YouTubeExtractor(); |
| 26 WebEmbed result = (WebEmbed) extractor.extract(youtube); | 24 WebEmbed result = (WebEmbed) extractor.extract(youtube); |
| 27 | 25 |
| 28 // Check YouTube specific attributes | 26 // Check YouTube specific attributes |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // Test no important twitter content. | 192 // Test no important twitter content. |
| 195 notTwitter = TestUtil.createIframe(); | 193 notTwitter = TestUtil.createIframe(); |
| 196 mBody.appendChild(notTwitter); | 194 mBody.appendChild(notTwitter); |
| 197 notTwitter.getContentDocument().getBody().setInnerHTML( | 195 notTwitter.getContentDocument().getBody().setInnerHTML( |
| 198 iframeStructure.replaceAll("data-tweet-id", "data-bad-id")); | 196 iframeStructure.replaceAll("data-tweet-id", "data-bad-id")); |
| 199 | 197 |
| 200 result = (WebEmbed) extractor.extract(notTwitter); | 198 result = (WebEmbed) extractor.extract(notTwitter); |
| 201 assertNull(result); | 199 assertNull(result); |
| 202 } | 200 } |
| 203 } | 201 } |
| OLD | NEW |