OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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.chrome.browser.webapps; | 5 package org.chromium.chrome.browser.webapps; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.support.test.filters.MediumTest; | 8 import android.support.test.filters.MediumTest; |
9 | 9 |
10 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 startMainActivityOnBlankPage(); | 101 startMainActivityOnBlankPage(); |
102 } | 102 } |
103 | 103 |
104 /** Creates and starts a WebApkUpdateDataFetcher. */ | 104 /** Creates and starts a WebApkUpdateDataFetcher. */ |
105 private void startWebApkUpdateDataFetcher(final String scopeUrl, | 105 private void startWebApkUpdateDataFetcher(final String scopeUrl, |
106 final String manifestUrl, final WebApkUpdateDataFetcher.Observer obs
erver) { | 106 final String manifestUrl, final WebApkUpdateDataFetcher.Observer obs
erver) { |
107 final WebApkUpdateDataFetcher fetcher = new WebApkUpdateDataFetcher(); | 107 final WebApkUpdateDataFetcher fetcher = new WebApkUpdateDataFetcher(); |
108 ThreadUtils.runOnUiThread(new Runnable() { | 108 ThreadUtils.runOnUiThread(new Runnable() { |
109 @Override | 109 @Override |
110 public void run() { | 110 public void run() { |
111 WebApkInfo oldInfo = WebApkInfo.create("", "", scopeUrl, null, n
ull, null, -1, -1, | 111 WebApkInfo oldInfo = WebApkInfo.create("", "", false /* forceNav
igation */, |
112 -1, -1, -1, "random.package", -1, manifestUrl, "", | 112 scopeUrl, null, null, null, -1, -1, -1, -1, -1, "random.
package", -1, |
113 new HashMap<String, String>()); | 113 manifestUrl, "", new HashMap<String, String>()); |
114 fetcher.start(mTab, oldInfo, observer); | 114 fetcher.start(mTab, oldInfo, observer); |
115 } | 115 } |
116 }); | 116 }); |
117 } | 117 } |
118 | 118 |
119 /** | 119 /** |
120 * Test starting WebApkUpdateDataFetcher while a page with the desired manif
est URL is loading. | 120 * Test starting WebApkUpdateDataFetcher while a page with the desired manif
est URL is loading. |
121 */ | 121 */ |
122 @MediumTest | 122 @MediumTest |
123 @Feature({"WebApk"}) | 123 @Feature({"WebApk"}) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 mTestServer, mTab, WEB_MANIFEST_WITH_LONG_ICON_MURMUR2_HASH); | 187 mTestServer, mTab, WEB_MANIFEST_WITH_LONG_ICON_MURMUR2_HASH); |
188 | 188 |
189 CallbackWaiter waiter = new CallbackWaiter(); | 189 CallbackWaiter waiter = new CallbackWaiter(); |
190 startWebApkUpdateDataFetcher(mTestServer.getURL(WEB_MANIFEST_SCOPE), | 190 startWebApkUpdateDataFetcher(mTestServer.getURL(WEB_MANIFEST_SCOPE), |
191 mTestServer.getURL(WEB_MANIFEST_WITH_LONG_ICON_MURMUR2_HASH), wa
iter); | 191 mTestServer.getURL(WEB_MANIFEST_WITH_LONG_ICON_MURMUR2_HASH), wa
iter); |
192 waiter.waitForCallback(0); | 192 waiter.waitForCallback(0); |
193 | 193 |
194 assertEquals(LONG_ICON_MURMUR2_HASH, waiter.bestIconMurmur2Hash()); | 194 assertEquals(LONG_ICON_MURMUR2_HASH, waiter.bestIconMurmur2Hash()); |
195 } | 195 } |
196 } | 196 } |
OLD | NEW |