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

Unified Diff: components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm

Issue 2134853002: Fixes ClipboardRecentContentIOSTest on iOS 10. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm
diff --git a/components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm b/components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm
index 8f47b4513c312a9b59a48e94423309aaa2c4c238..39f127e7c3e36a1b02bca844b4fada507af88446 100644
--- a/components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm
+++ b/components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm
@@ -4,6 +4,7 @@
#include "components/open_from_clipboard/clipboard_recent_content_ios.h"
+#import <CoreGraphics/CoreGraphics.h>
#import <UIKit/UIKit.h>
#include <memory>
@@ -13,6 +14,20 @@
namespace {
+UIImage* TestUIImage() {
+ CGRect frame = CGRectMake(0, 0, 1.0, 1.0);
+ UIGraphicsBeginImageContext(frame.size);
+
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
+ CGContextFillRect(context, frame);
+
+ UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+
+ return image;
+}
+
void SetPasteboardImage(UIImage* image) {
[[UIPasteboard generalPasteboard] setImage:image];
}
@@ -154,7 +169,7 @@ TEST_F(ClipboardRecentContentIOSTest, AddingNonStringRemovesCachedString) {
// Overwrite pasteboard with an image.
base::scoped_nsobject<UIImage> image([[UIImage alloc] init]);
- SetPasteboardImage(image);
+ SetPasteboardImage(TestUIImage());
// Pasteboard should appear empty.
EXPECT_FALSE(clipboard_content_->GetRecentURLFromClipboard(&gurl));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698