| 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 static org.junit.Assert.assertEquals; | 7 import static org.junit.Assert.assertEquals; |
| 8 import static org.junit.Assert.assertFalse; | 8 import static org.junit.Assert.assertFalse; |
| 9 import static org.junit.Assert.assertTrue; | 9 import static org.junit.Assert.assertTrue; |
| 10 | 10 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 | 170 |
| 171 private WebappDataStorage getStorage() { | 171 private WebappDataStorage getStorage() { |
| 172 return WebappRegistry.getInstance().getWebappDataStorage(WEBAPK_ID); | 172 return WebappRegistry.getInstance().getWebappDataStorage(WEBAPK_ID); |
| 173 } | 173 } |
| 174 | 174 |
| 175 private void updateIfNeeded(WebApkUpdateManager updateManager) { | 175 private void updateIfNeeded(WebApkUpdateManager updateManager) { |
| 176 WebApkInfo info = WebApkInfo.create(WEBAPK_ID, WEBAPK_START_URL, null, n
ull, null, null, | 176 WebApkInfo info = WebApkInfo.create(WEBAPK_ID, WEBAPK_START_URL, null, n
ull, null, null, |
| 177 WebDisplayMode.Standalone, ScreenOrientationValues.DEFAULT, Shor
tcutSource.UNKNOWN, | 177 WebDisplayMode.Standalone, ScreenOrientationValues.DEFAULT, Shor
tcutSource.UNKNOWN, |
| 178 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, | 178 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, |
| 179 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false, | 179 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, |
| 180 WebApkTestHelper.WEBAPK_PACKAGE_NAME); | 180 WebApkTestHelper.WEBAPK_PACKAGE_NAME); |
| 181 updateManager.updateIfNeeded(null, info); | 181 updateManager.updateIfNeeded(null, info); |
| 182 } | 182 } |
| 183 | 183 |
| 184 private void onGotWebApkCompatibleWebManifestForInitialUrl( | 184 private void onGotWebApkCompatibleWebManifestForInitialUrl( |
| 185 WebApkUpdateManager updateManager, boolean needsUpdate) { | 185 WebApkUpdateManager updateManager, boolean needsUpdate) { |
| 186 FetchedManifestData fetchedManifestData = new FetchedManifestData(); | 186 FetchedManifestData fetchedManifestData = new FetchedManifestData(); |
| 187 fetchedManifestData.name = WEB_MANIFEST_NAME; | 187 fetchedManifestData.name = WEB_MANIFEST_NAME; |
| 188 updateManager.onFinishedFetchingWebManifestForInitialUrl(needsUpdate, fe
tchedManifestData); | 188 updateManager.onFinishedFetchingWebManifestForInitialUrl(needsUpdate, fe
tchedManifestData); |
| 189 } | 189 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 updateIfNeeded(updateManager); | 478 updateIfNeeded(updateManager); |
| 479 updateManager.onFinishedFetchingWebManifestForInitialUrl(false, null); | 479 updateManager.onFinishedFetchingWebManifestForInitialUrl(false, null); |
| 480 updateManager.onGotManifestData(false, new FetchedManifestData()); | 480 updateManager.onGotManifestData(false, new FetchedManifestData()); |
| 481 assertFalse(updateManager.updateRequested()); | 481 assertFalse(updateManager.updateRequested()); |
| 482 | 482 |
| 483 // We got the Web Manifest. The {@link ManifestUpgradeDetector} should b
e destroyed to stop | 483 // We got the Web Manifest. The {@link ManifestUpgradeDetector} should b
e destroyed to stop |
| 484 // it from fetching the Web Manifest for subsequent page loads. | 484 // it from fetching the Web Manifest for subsequent page loads. |
| 485 assertTrue(updateManager.destroyedManifestUpgradeDetector()); | 485 assertTrue(updateManager.destroyedManifestUpgradeDetector()); |
| 486 } | 486 } |
| 487 } | 487 } |
| OLD | NEW |