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

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java

Issue 18903004: Remove test checking for default touch icons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.android_webview.test; 5 package org.chromium.android_webview.test;
6 6
7 import android.graphics.Bitmap; 7 import android.graphics.Bitmap;
8 import android.graphics.BitmapFactory; 8 import android.graphics.BitmapFactory;
9 import android.test.suitebuilder.annotation.SmallTest; 9 import android.test.suitebuilder.annotation.SmallTest;
10 10
(...skipping 11 matching lines...) Expand all
22 */ 22 */
23 public class AwContentsClientFaviconTest extends AwTestBase { 23 public class AwContentsClientFaviconTest extends AwTestBase {
24 24
25 private static final String FAVICON1_URL = "/favicon1.png"; 25 private static final String FAVICON1_URL = "/favicon1.png";
26 private static final String FAVICON1_PAGE_URL = "/favicon1.html"; 26 private static final String FAVICON1_PAGE_URL = "/favicon1.html";
27 private static final String FAVICON1_PAGE_HTML = 27 private static final String FAVICON1_PAGE_HTML =
28 CommonResources.makeHtmlPageFrom( 28 CommonResources.makeHtmlPageFrom(
29 "<link rel=\"icon\" href=\""+ FAVICON1_URL + "\" />", 29 "<link rel=\"icon\" href=\""+ FAVICON1_URL + "\" />",
30 "Body"); 30 "Body");
31 31
32 private static final String TOUCHICON_URL = "apple-touch-icon.png";
33 private static final String TOUCHICON_PRECOMPOSED_URL = "apple-touch-icon-pr ecomposed.png";
34
35 private static final String TOUCHICON_REL_LINK = "touch.png"; 32 private static final String TOUCHICON_REL_LINK = "touch.png";
36 private static final String TOUCHICON_REL_LINK_72 = "touch_72.png"; 33 private static final String TOUCHICON_REL_LINK_72 = "touch_72.png";
37 private static final String TOUCHICON_REL_URL = "/" + TOUCHICON_REL_LINK; 34 private static final String TOUCHICON_REL_URL = "/" + TOUCHICON_REL_LINK;
38 private static final String TOUCHICON_REL_URL_72 = "/" + TOUCHICON_REL_LINK_ 72; 35 private static final String TOUCHICON_REL_URL_72 = "/" + TOUCHICON_REL_LINK_ 72;
39 private static final String TOUCHICON_REL_PAGE_HTML = 36 private static final String TOUCHICON_REL_PAGE_HTML =
40 CommonResources.makeHtmlPageFrom( 37 CommonResources.makeHtmlPageFrom(
41 "<link rel=\"apple-touch-icon\" href=\""+ TOUCHICON_REL_URL + "\" />" + 38 "<link rel=\"apple-touch-icon\" href=\""+ TOUCHICON_REL_URL + "\" />" +
42 "<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\""+ TOUCHICON_REL_ URL_72 + "\" />", 39 "<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\""+ TOUCHICON_REL_ URL_72 + "\" />",
43 "Body"); 40 "Body");
44 41
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 111
115 mContentsClient.mFaviconHelper.waitForCallback(callCount); 112 mContentsClient.mFaviconHelper.waitForCallback(callCount);
116 Object originalFaviconSource = (new URL(faviconUrl)).getContent(); 113 Object originalFaviconSource = (new URL(faviconUrl)).getContent();
117 Bitmap originalFavicon = BitmapFactory.decodeStream((InputStream)origina lFaviconSource); 114 Bitmap originalFavicon = BitmapFactory.decodeStream((InputStream)origina lFaviconSource);
118 assertNotNull(originalFavicon); 115 assertNotNull(originalFavicon);
119 assertNotNull(mContentsClient.mFaviconHelper.mIcon); 116 assertNotNull(mContentsClient.mFaviconHelper.mIcon);
120 assertTrue(mContentsClient.mFaviconHelper.mIcon.sameAs(originalFavicon)) ; 117 assertTrue(mContentsClient.mFaviconHelper.mIcon.sameAs(originalFavicon)) ;
121 } 118 }
122 119
123 @SmallTest 120 @SmallTest
124 public void testReceiveBasicTouchIconRoot() throws Throwable {
125 init(new TestAwContentsClientTouchIcon());
126 int callCount = mContentsClient.mFaviconHelper.getCallCount();
127
128 // Use the favicon page url. Since this does not specify a link rel for touch icon,
129 // we should get the default touch icon urls in the callback.
130 final String pageUrl = mWebServer.setResponse(FAVICON1_PAGE_URL, FAVICON 1_PAGE_HTML,
131 CommonResources.getTextHtmlHeaders(true));
132
133 loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), page Url);
134
135 mContentsClient.mFaviconHelper.waitForCallback(callCount, 2);
136
137 HashMap<String, Boolean> touchIcons = mContentsClient.mFaviconHelper.mTo uchIcons;
138 assertEquals(2, touchIcons.size());
139 assertFalse(touchIcons.get(mWebServer.getBaseUrl() + TOUCHICON_URL));
140 assertTrue(touchIcons.get(mWebServer.getBaseUrl() + TOUCHICON_PRECOMPOSE D_URL));
141 }
142
143 @SmallTest
144 public void testReceiveBasicTouchIconLinkRel() throws Throwable { 121 public void testReceiveBasicTouchIconLinkRel() throws Throwable {
145 init(new TestAwContentsClientTouchIcon()); 122 init(new TestAwContentsClientTouchIcon());
146 int callCount = mContentsClient.mFaviconHelper.getCallCount(); 123 int callCount = mContentsClient.mFaviconHelper.getCallCount();
147 124
148 final String pageUrl = mWebServer.setResponse(TOUCHICON_REL_URL, TOUCHIC ON_REL_PAGE_HTML, 125 final String pageUrl = mWebServer.setResponse(TOUCHICON_REL_URL, TOUCHIC ON_REL_PAGE_HTML,
149 CommonResources.getTextHtmlHeaders(true)); 126 CommonResources.getTextHtmlHeaders(true));
150 127
151 loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), page Url); 128 loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), page Url);
152 129
153 mContentsClient.mFaviconHelper.waitForCallback(callCount,2); 130 mContentsClient.mFaviconHelper.waitForCallback(callCount,2);
154 HashMap<String, Boolean> touchIcons = mContentsClient.mFaviconHelper.mTo uchIcons; 131 HashMap<String, Boolean> touchIcons = mContentsClient.mFaviconHelper.mTo uchIcons;
155 assertEquals(2, touchIcons.size()); 132 assertEquals(2, touchIcons.size());
156 assertFalse(touchIcons.get(mWebServer.getBaseUrl() + TOUCHICON_REL_LINK) ); 133 assertFalse(touchIcons.get(mWebServer.getBaseUrl() + TOUCHICON_REL_LINK) );
157 assertFalse(touchIcons.get(mWebServer.getBaseUrl() + TOUCHICON_REL_LINK_ 72)); 134 assertFalse(touchIcons.get(mWebServer.getBaseUrl() + TOUCHICON_REL_LINK_ 72));
158 } 135 }
159 } 136 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698