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

Unified Diff: ios/chrome/browser/snapshots/snapshot_cache_unittest.mm

Issue 1725533004: Enable iPad Tab Switcher by default on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unittests. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/snapshots/snapshot_cache.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/snapshots/snapshot_cache_unittest.mm
diff --git a/ios/chrome/browser/snapshots/snapshot_cache_unittest.mm b/ios/chrome/browser/snapshots/snapshot_cache_unittest.mm
index ef3145d505995afe4aa74d6ca81610742849d458..886b945d167885c0e65b195a2f40db2a58bbbbfe 100644
--- a/ios/chrome/browser/snapshots/snapshot_cache_unittest.mm
+++ b/ios/chrome/browser/snapshots/snapshot_cache_unittest.mm
@@ -9,7 +9,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
-#include "base/ios/ios_util.h"
#include "base/location.h"
#include "base/mac/bind_objc_block.h"
#include "base/mac/scoped_nsautorelease_pool.h"
@@ -31,6 +30,8 @@ static const NSUInteger kSnapshotPixelSize = 8;
@interface SnapshotCache (Testing)
+ (base::FilePath)imagePathForSessionID:(NSString*)sessionID;
+ (base::FilePath)greyImagePathForSessionID:(NSString*)sessionID;
+- (BOOL)cacheIsEnabled;
+- (BOOL)useLRUCache;
- (void)handleLowMemory;
@end
@@ -223,7 +224,7 @@ TEST_F(SnapshotCacheTest, Cache) {
SnapshotCache* cache = GetSnapshotCache();
NSUInteger expectedCacheSize = kSessionCount;
- if (experimental_flags::IsLRUSnapshotCacheEnabled())
+ if ([cache useLRUCache])
expectedCacheSize = MIN(kSessionCount, [cache lruCacheMaxSize]);
// Put all images in the cache.
@@ -349,14 +350,6 @@ TEST_F(SnapshotCacheTest, Purge) {
// Loads the color images into the cache, and pins two of them. Ensures that
// only the two pinned IDs remain in memory after a call to -handleLowMemory.
TEST_F(SnapshotCacheTest, HandleLowMemory) {
-// TODO(droger): This test fails on iPad iOS8 device: http://crbug.com/455209
-#if !TARGET_IPHONE_SIMULATOR
- if (IsIPadIdiom() && base::ios::IsRunningOnIOS8OrLater()) {
- LOG(WARNING) << "Test disabled on iPad iOS8 device.";
- return;
- }
-#endif
-
LoadAllColorImagesIntoCache(true);
SnapshotCache* cache = GetSnapshotCache();
@@ -367,16 +360,10 @@ TEST_F(SnapshotCacheTest, HandleLowMemory) {
[set addObject:firstPinnedID];
[set addObject:secondPinnedID];
cache.pinnedIDs = set;
+ [cache handleLowMemory];
- if (!IsIPadIdiom() || experimental_flags::IsTabSwitcherEnabled())
- [cache handleLowMemory];
-
- BOOL expectedValue = YES;
- if (IsIPadIdiom() && !experimental_flags::IsTabSwitcherEnabled())
- expectedValue = NO;
-
- EXPECT_EQ(expectedValue, [cache hasImageInMemory:firstPinnedID]);
- EXPECT_EQ(expectedValue, [cache hasImageInMemory:secondPinnedID]);
+ EXPECT_EQ(YES, [cache hasImageInMemory:firstPinnedID]);
+ EXPECT_EQ(YES, [cache hasImageInMemory:secondPinnedID]);
NSString* notPinnedID = [testSessions_ objectAtIndex:2];
EXPECT_FALSE([cache hasImageInMemory:notPinnedID]);
« no previous file with comments | « ios/chrome/browser/snapshots/snapshot_cache.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698