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

Side by Side Diff: chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java

Issue 2935853002: [Android Refactor] Reland: Merge WebappDataStorage#LAST_USED_UNSET and LAST_USED_INVALID (Closed)
Patch Set: Merge branch 'master' into reland Created 3 years, 6 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
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 private static final int DISPLAY_MODE = WebDisplayMode.UNDEFINED; 64 private static final int DISPLAY_MODE = WebDisplayMode.UNDEFINED;
65 private static final int ORIENTATION = ScreenOrientationValues.DEFAULT; 65 private static final int ORIENTATION = ScreenOrientationValues.DEFAULT;
66 private static final long THEME_COLOR = 1L; 66 private static final long THEME_COLOR = 1L;
67 private static final long BACKGROUND_COLOR = 2L; 67 private static final long BACKGROUND_COLOR = 2L;
68 68
69 /** Different name than the one used in {@link defaultManifestData()}. */ 69 /** Different name than the one used in {@link defaultManifestData()}. */
70 private static final String DIFFERENT_NAME = "Different Name"; 70 private static final String DIFFERENT_NAME = "Different Name";
71 71
72 /** {@link WebappDataStorage#Clock} subclass which enables time to be manual ly advanced. */ 72 /** {@link WebappDataStorage#Clock} subclass which enables time to be manual ly advanced. */
73 private static class MockClock extends WebappDataStorage.Clock { 73 private static class MockClock extends WebappDataStorage.Clock {
74 // 0 has a special meaning: {@link WebappDataStorage#LAST_USED_UNSET}. 74 // 0 has a special meaning: {@link WebappDataStorage#TIMESTAMP_INVALID}.
75 private long mTimeMillis = 1; 75 private long mTimeMillis = 1;
76 76
77 public void advance(long millis) { 77 public void advance(long millis) {
78 mTimeMillis += millis; 78 mTimeMillis += millis;
79 } 79 }
80 80
81 @Override 81 @Override
82 public long currentTimeMillis() { 82 public long currentTimeMillis() {
83 return mTimeMillis; 83 return mTimeMillis;
84 } 84 }
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 781
782 // A previous update request was made for the current ShellAPK version. A WebAPK update 782 // A previous update request was made for the current ShellAPK version. A WebAPK update
783 // should be requested after the regular delay. 783 // should be requested after the regular delay.
784 mClock.advance(WebappDataStorage.UPDATE_INTERVAL - 1); 784 mClock.advance(WebappDataStorage.UPDATE_INTERVAL - 1);
785 updateIfNeeded(updateManager); 785 updateIfNeeded(updateManager);
786 assertTrue(updateManager.updateCheckStarted()); 786 assertTrue(updateManager.updateCheckStarted());
787 onGotManifestData(updateManager, defaultManifestData()); 787 onGotManifestData(updateManager, defaultManifestData());
788 assertTrue(updateManager.updateRequested()); 788 assertTrue(updateManager.updateRequested());
789 } 789 }
790 } 790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698