summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Gorski <fgorski@chromium.org>2016-02-02 11:12:19 -0800
committerFilip Gorski <fgorski@chromium.org>2016-02-02 19:14:32 +0000
commit53b5c9193b7d5d54b8a683db1efda87c3ada7986 (patch)
treeeaff1be57c44ffeb8b9caed958b11025c45de0ee
parentaecedda7cbbd13d3cc65d104b275dd79a28a6daa (diff)
downloadchromium_src-53b5c9193b7d5d54b8a683db1efda87c3ada7986.zip
chromium_src-53b5c9193b7d5d54b8a683db1efda87c3ada7986.tar.gz
chromium_src-53b5c9193b7d5d54b8a683db1efda87c3ada7986.tar.bz2
[Offline pages] Fixing restoring bookmarks filter, when offline pages disabled
Ensures that when enhanced bookmarks UI is restoring the past filter for content saved offline, and offline pages are disabled, it is treating the state as invalid and reverts to the all bookmarks state. BUG=581976 Review URL: https://codereview.chromium.org/1656103002 Cr-Commit-Position: refs/heads/master@{#372983} (cherry picked from commit d1b363e7940c0b5cbc5eebd333af929b0d60032a) Review URL: https://codereview.chromium.org/1662563002 . Cr-Commit-Position: refs/branch-heads/2623@{#241} Cr-Branched-From: 92d77538a86529ca35f9220bd3cd512cbea1f086-refs/heads/master@{#369907}
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUIState.java10
-rw-r--r--chrome/android/javatests/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java8
2 files changed, 16 insertions, 2 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUIState.java b/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUIState.java
index 20dbdf0..21557dd 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUIState.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUIState.java
@@ -8,6 +8,7 @@ import android.net.Uri;
import android.text.TextUtils;
import org.chromium.chrome.browser.UrlConstants;
+import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
import org.chromium.components.bookmarks.BookmarkId;
/**
@@ -151,8 +152,13 @@ class EnhancedBookmarkUIState {
&& !mFolder.equals(bookmarkModel.getRootFolderId());
}
- if (mState == STATE_FILTER && mFilter == null) return false;
+ if (mState == STATE_FILTER) {
+ if (mFilter == null) return false;
+ if (mFilter == EnhancedBookmarkFilter.OFFLINE_PAGES) {
+ return OfflinePageBridge.isEnabled();
+ }
+ }
return true;
}
-} \ No newline at end of file
+}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java
index e21b815..5bfccce 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java
@@ -241,4 +241,12 @@ public class EnhancedBookmarkTest extends ChromeActivityTestCaseBase<ChromeActiv
assertEquals(UrlConstants.BOOKMARKS_URL,
EnhancedBookmarkUtils.getLastUsedUrl(getActivity()));
}
+
+ @SmallTest
+ @CommandLineFlags.Add(ChromeSwitches.DISABLE_OFFLINE_PAGES)
+ public void testOpenBookmarkManagerInOfflinePageWhenDisabled() throws InterruptedException {
+ openBookmarkManager("chrome-native://bookmarks/filter/OFFLINE_PAGES");
+ EnhancedBookmarkDelegate delegate = mItemsContainer.getDelegateForTesting();
+ assertEquals(EnhancedBookmarkUIState.STATE_ALL_BOOKMARKS, delegate.getCurrentState());
+ }
}