diff options
author | Ben Murdoch <benm@google.com> | 2011-09-15 12:47:48 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-09-15 13:00:43 +0100 |
commit | 327e3ac66da7b67dadf16e93dc3a8bb5ecf0efd0 (patch) | |
tree | 95bcec242cdc6b78d81148c17981d196492742c5 | |
parent | ef4a243155bec06dfa88039e3b76f5709f014993 (diff) | |
download | android_packages_apps_Gello-327e3ac66da7b67dadf16e93dc3a8bb5ecf0efd0.tar.gz android_packages_apps_Gello-327e3ac66da7b67dadf16e93dc3a8bb5ecf0efd0.tar.bz2 android_packages_apps_Gello-327e3ac66da7b67dadf16e93dc3a8bb5ecf0efd0.zip |
Fix WebStorageSizeManagerUnitTest NPE
Previously we passed a null Context into the WebStorageSizeManager
from the unit test. After the refactoring to get the
application context from the passed in Context, this no longer
works. So pass in a valid Context.
(See Ib0be5f8c for the regression)
Bug: 5319628
Change-Id: I691e2edb0a4174076c7599525569d104a83d3442
-rw-r--r-- | src/com/android/browser/WebStorageSizeManager.java | 4 | ||||
-rw-r--r-- | tests/src/com/android/browser/WebStorageSizeManagerUnitTests.java | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/com/android/browser/WebStorageSizeManager.java b/src/com/android/browser/WebStorageSizeManager.java index 109a02b9..73a3bfbe 100644 --- a/src/com/android/browser/WebStorageSizeManager.java +++ b/src/com/android/browser/WebStorageSizeManager.java @@ -392,10 +392,6 @@ public class WebStorageSizeManager { if(LOGV_ENABLED) { Log.v(LOGTAG, "scheduleOutOfSpaceNotification called."); } - if (mContext == null) { - // mContext can be null if we're running unit tests. - return; - } if ((mLastOutOfSpaceNotificationTime == -1) || (System.currentTimeMillis() - mLastOutOfSpaceNotificationTime > NOTIFICATION_INTERVAL)) { // setup the notification boilerplate. diff --git a/tests/src/com/android/browser/WebStorageSizeManagerUnitTests.java b/tests/src/com/android/browser/WebStorageSizeManagerUnitTests.java index 354c4da3..2beedf8b 100644 --- a/tests/src/com/android/browser/WebStorageSizeManagerUnitTests.java +++ b/tests/src/com/android/browser/WebStorageSizeManagerUnitTests.java @@ -90,7 +90,8 @@ public class WebStorageSizeManagerUnitTests extends AndroidTestCase { // We have an appcache file size of 0 MB. mAppCacheInfo.setAppCacheSizeBytes(0); // Create the manager. - WebStorageSizeManager manager = new WebStorageSizeManager(null, mDiskInfo, mAppCacheInfo); + WebStorageSizeManager manager = new WebStorageSizeManager(getContext(), mDiskInfo, + mAppCacheInfo); // We add origin 1. long origin1Quota = 0; long origin1EstimatedSize = bytes(3.5); @@ -247,7 +248,8 @@ public class WebStorageSizeManagerUnitTests extends AndroidTestCase { mAppCacheInfo.setAppCacheSizeBytes(0); // Create the manager. - WebStorageSizeManager manager = new WebStorageSizeManager(null, mDiskInfo, mAppCacheInfo); + WebStorageSizeManager manager = new WebStorageSizeManager(getContext(), mDiskInfo, + mAppCacheInfo); // We add an origin. long originQuota = 0; |