| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #import "ios/chrome/browser/snapshots/snapshot_cache.h" | 5 #import "ios/chrome/browser/snapshots/snapshot_cache.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 if (i == 0) | 342 if (i == 0) |
| 343 EXPECT_TRUE(base::PathExists(path)); | 343 EXPECT_TRUE(base::PathExists(path)); |
| 344 else | 344 else |
| 345 EXPECT_FALSE(base::PathExists(path)); | 345 EXPECT_FALSE(base::PathExists(path)); |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 | 348 |
| 349 // Loads the color images into the cache, and pins two of them. Ensures that | 349 // Loads the color images into the cache, and pins two of them. Ensures that |
| 350 // only the two pinned IDs remain in memory after a call to -handleLowMemory. | 350 // only the two pinned IDs remain in memory after a call to -handleLowMemory. |
| 351 TEST_F(SnapshotCacheTest, HandleLowMemory) { | 351 TEST_F(SnapshotCacheTest, HandleLowMemory) { |
| 352 // TODO(droger): This test fails on iPad iOS8 device: http://crbug.com/455209 | 352 // TODO(crbug.com/455209): This test failed on iPad iOS8 device, but may no |
| 353 // longer be failing on iOS 9 and up. Should test by re-enabling and monitor. |
| 353 #if !TARGET_IPHONE_SIMULATOR | 354 #if !TARGET_IPHONE_SIMULATOR |
| 354 if (IsIPadIdiom() && base::ios::IsRunningOnIOS8OrLater()) { | 355 if (IsIPadIdiom()) { |
| 355 LOG(WARNING) << "Test disabled on iPad iOS8 device."; | 356 LOG(WARNING) << "Test disabled on iPad device."; |
| 356 return; | 357 return; |
| 357 } | 358 } |
| 358 #endif | 359 #endif |
| 359 | 360 |
| 360 LoadAllColorImagesIntoCache(true); | 361 LoadAllColorImagesIntoCache(true); |
| 361 | 362 |
| 362 SnapshotCache* cache = GetSnapshotCache(); | 363 SnapshotCache* cache = GetSnapshotCache(); |
| 363 | 364 |
| 364 NSString* firstPinnedID = [testSessions_ objectAtIndex:4]; | 365 NSString* firstPinnedID = [testSessions_ objectAtIndex:4]; |
| 365 NSString* secondPinnedID = [testSessions_ objectAtIndex:6]; | 366 NSString* secondPinnedID = [testSessions_ objectAtIndex:6]; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 EXPECT_TRUE(base::PathExists(retinaFile)); | 583 EXPECT_TRUE(base::PathExists(retinaFile)); |
| 583 | 584 |
| 584 // Delete the image. | 585 // Delete the image. |
| 585 [cache removeImageWithSessionID:kSession]; | 586 [cache removeImageWithSessionID:kSession]; |
| 586 FlushRunLoops(); // ensure the file is removed. | 587 FlushRunLoops(); // ensure the file is removed. |
| 587 | 588 |
| 588 EXPECT_FALSE(base::PathExists(retinaFile)); | 589 EXPECT_FALSE(base::PathExists(retinaFile)); |
| 589 } | 590 } |
| 590 | 591 |
| 591 } // namespace | 592 } // namespace |
| OLD | NEW |