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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 192 } |
193 | 193 |
194 const char* GetPixelData(CGImageRef cgImage) { | 194 const char* GetPixelData(CGImageRef cgImage) { |
195 CFDataRef data = CGDataProviderCopyData(CGImageGetDataProvider(cgImage)); | 195 CFDataRef data = CGDataProviderCopyData(CGImageGetDataProvider(cgImage)); |
196 return reinterpret_cast<const char*>(CFDataGetBytePtr(data)); | 196 return reinterpret_cast<const char*>(CFDataGetBytePtr(data)); |
197 } | 197 } |
198 | 198 |
199 void TriggerMemoryWarning() { | 199 void TriggerMemoryWarning() { |
200 // _performMemoryWarning is a private API and must not be compiled into | 200 // _performMemoryWarning is a private API and must not be compiled into |
201 // official builds. | 201 // official builds. |
| 202 #pragma clang diagnostic push |
| 203 #pragma clang diagnostic ignored "-Wundeclared-selector" |
202 [[UIApplication sharedApplication] | 204 [[UIApplication sharedApplication] |
203 performSelector:@selector(_performMemoryWarning)]; | 205 performSelector:@selector(_performMemoryWarning)]; |
| 206 #pragma clang diagnostic pop |
204 } | 207 } |
205 | 208 |
206 web::TestWebThreadBundle thread_bundle_; | 209 web::TestWebThreadBundle thread_bundle_; |
207 base::scoped_nsobject<SnapshotCache> snapshotCache_; | 210 base::scoped_nsobject<SnapshotCache> snapshotCache_; |
208 base::scoped_nsobject<NSMutableArray> testSessions_; | 211 base::scoped_nsobject<NSMutableArray> testSessions_; |
209 base::scoped_nsobject<NSMutableArray> testImages_; | 212 base::scoped_nsobject<NSMutableArray> testImages_; |
210 }; | 213 }; |
211 | 214 |
212 // This test simply put all the snapshots in the cache and then gets them back | 215 // This test simply put all the snapshots in the cache and then gets them back |
213 // As the snapshots are kept in memory, the same pointer can be retrieved. | 216 // As the snapshots are kept in memory, the same pointer can be retrieved. |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 EXPECT_TRUE(base::PathExists(retinaFile)); | 569 EXPECT_TRUE(base::PathExists(retinaFile)); |
567 | 570 |
568 // Delete the image. | 571 // Delete the image. |
569 [cache removeImageWithSessionID:kSession]; | 572 [cache removeImageWithSessionID:kSession]; |
570 FlushRunLoops(); // ensure the file is removed. | 573 FlushRunLoops(); // ensure the file is removed. |
571 | 574 |
572 EXPECT_FALSE(base::PathExists(retinaFile)); | 575 EXPECT_FALSE(base::PathExists(retinaFile)); |
573 } | 576 } |
574 | 577 |
575 } // namespace | 578 } // namespace |
OLD | NEW |