| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 /** Checks whether a WebAPK update is needed. */ | 147 /** Checks whether a WebAPK update is needed. */ |
| 148 private boolean checkUpdateNeeded(final CreationData creationData) throws Ex
ception { | 148 private boolean checkUpdateNeeded(final CreationData creationData) throws Ex
ception { |
| 149 CallbackHelper waiter = new CallbackHelper(); | 149 CallbackHelper waiter = new CallbackHelper(); |
| 150 WebappDataStorage storage = WebappRegistry.getInstance().getWebappDataSt
orage(WEBAPK_ID); | 150 WebappDataStorage storage = WebappRegistry.getInstance().getWebappDataSt
orage(WEBAPK_ID); |
| 151 final TestWebApkUpdateManager updateManager = new TestWebApkUpdateManage
r(waiter, storage); | 151 final TestWebApkUpdateManager updateManager = new TestWebApkUpdateManage
r(waiter, storage); |
| 152 | 152 |
| 153 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 153 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 154 @Override | 154 @Override |
| 155 public void run() { | 155 public void run() { |
| 156 WebApkInfo info = WebApkInfo.create(WEBAPK_ID, "", creationData.
scope, null, | 156 WebApkInfo info = WebApkInfo.create(WEBAPK_ID, "", false /* forc
eNavigation */, |
| 157 creationData.name, creationData.shortName, creationData.
displayMode, | 157 creationData.scope, null, creationData.name, creationDat
a.shortName, |
| 158 creationData.orientation, 0, creationData.themeColor, | 158 creationData.displayMode, creationData.orientation, 0, |
| 159 creationData.backgroundColor, "", WebApkVersion.CURRENT_
SHELL_APK_VERSION, | 159 creationData.themeColor, creationData.backgroundColor, "
", |
| 160 creationData.manifestUrl, creationData.startUrl, | 160 WebApkVersion.CURRENT_SHELL_APK_VERSION, creationData.ma
nifestUrl, |
| 161 creationData.iconUrlToMurmur2HashMap); | 161 creationData.startUrl, creationData.iconUrlToMurmur2Hash
Map); |
| 162 updateManager.updateIfNeeded(mTab, info); | 162 updateManager.updateIfNeeded(mTab, info); |
| 163 } | 163 } |
| 164 }); | 164 }); |
| 165 waiter.waitForCallback(0); | 165 waiter.waitForCallback(0); |
| 166 | 166 |
| 167 return updateManager.needsUpdate(); | 167 return updateManager.needsUpdate(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 /** | 170 /** |
| 171 * Test that the canonicalized URLs are used in determining whether the fetc
hed Web Manifest | 171 * Test that the canonicalized URLs are used in determining whether the fetc
hed Web Manifest |
| (...skipping 23 matching lines...) Expand all Loading... |
| 195 // URL canonicalization should replace "%62" with 'b'. | 195 // URL canonicalization should replace "%62" with 'b'. |
| 196 CreationData creationData = defaultCreationData(mTestServer); | 196 CreationData creationData = defaultCreationData(mTestServer); |
| 197 creationData.startUrl = mTestServer.getURL( | 197 creationData.startUrl = mTestServer.getURL( |
| 198 "/chrome/test/data/banners/manifest_%62est_page.html"); | 198 "/chrome/test/data/banners/manifest_%62est_page.html"); |
| 199 | 199 |
| 200 WebappTestPage.navigateToPageWithServiceWorkerAndManifest( | 200 WebappTestPage.navigateToPageWithServiceWorkerAndManifest( |
| 201 mTestServer, mTab, WEBAPK_MANIFEST_URL); | 201 mTestServer, mTab, WEBAPK_MANIFEST_URL); |
| 202 assertTrue(checkUpdateNeeded(creationData)); | 202 assertTrue(checkUpdateNeeded(creationData)); |
| 203 } | 203 } |
| 204 } | 204 } |
| OLD | NEW |