| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 int colors[] = { color }; | 267 int colors[] = { color }; |
| 268 return ShadowBitmap.createBitmap(colors, 1, 1, Bitmap.Config.ALPHA_8); | 268 return ShadowBitmap.createBitmap(colors, 1, 1, Bitmap.Config.ALPHA_8); |
| 269 } | 269 } |
| 270 | 270 |
| 271 private static void updateIfNeeded(WebApkUpdateManager updateManager) { | 271 private static void updateIfNeeded(WebApkUpdateManager updateManager) { |
| 272 // Use the intent version of {@link WebApkInfo#create()} in order to tes
t default values | 272 // Use the intent version of {@link WebApkInfo#create()} in order to tes
t default values |
| 273 // set by the intent version of {@link WebApkInfo#create()}. | 273 // set by the intent version of {@link WebApkInfo#create()}. |
| 274 Intent intent = new Intent(); | 274 Intent intent = new Intent(); |
| 275 intent.putExtra(ShortcutHelper.EXTRA_URL, ""); | 275 intent.putExtra(ShortcutHelper.EXTRA_URL, ""); |
| 276 intent.putExtra( | 276 intent.putExtra( |
| 277 ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBAP
K_PACKAGE_NAME); | 277 WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WebApkTestHelper.WEBA
PK_PACKAGE_NAME); |
| 278 WebApkInfo info = WebApkInfo.create(intent); | 278 WebApkInfo info = WebApkInfo.create(intent); |
| 279 | 279 |
| 280 updateManager.updateIfNeeded(null, info); | 280 updateManager.updateIfNeeded(null, info); |
| 281 } | 281 } |
| 282 | 282 |
| 283 private static void onGotUnchangedWebManifestData(WebApkUpdateManager update
Manager) { | 283 private static void onGotUnchangedWebManifestData(WebApkUpdateManager update
Manager) { |
| 284 onGotManifestData(updateManager, defaultManifestData()); | 284 onGotManifestData(updateManager, defaultManifestData()); |
| 285 } | 285 } |
| 286 | 286 |
| 287 private static void onGotManifestData(WebApkUpdateManager updateManager, | 287 private static void onGotManifestData(WebApkUpdateManager updateManager, |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 // Since {@link WebApkActivity#OnStop()} calls {@link requestPendingUpda
te()} to trigger an | 719 // Since {@link WebApkActivity#OnStop()} calls {@link requestPendingUpda
te()} to trigger an |
| 720 // update request, we call it directly for testing. | 720 // update request, we call it directly for testing. |
| 721 updateManager.setIsWebApkForeground(false); | 721 updateManager.setIsWebApkForeground(false); |
| 722 updateManager.requestPendingUpdate(); | 722 updateManager.requestPendingUpdate(); |
| 723 | 723 |
| 724 assertFalse(updateManager.getHasPendingUpdateForTesting()); | 724 assertFalse(updateManager.getHasPendingUpdateForTesting()); |
| 725 assertTrue(updateManager.updateRequested()); | 725 assertTrue(updateManager.updateRequested()); |
| 726 assertEquals(0, storage.getUpdateRequests()); | 726 assertEquals(0, storage.getUpdateRequests()); |
| 727 } | 727 } |
| 728 } | 728 } |
| OLD | NEW |