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

Unified Diff: components/open_from_clipboard/clipboard_recent_content_ios.mm

Issue 961673004: Add unittest to Open from Clipboard component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added error to check that the test is ran. Created 5 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
Index: components/open_from_clipboard/clipboard_recent_content_ios.mm
diff --git a/components/open_from_clipboard/clipboard_recent_content_ios.mm b/components/open_from_clipboard/clipboard_recent_content_ios.mm
index 4cc2ed579532fd5626e2292c81bfee84a26f6151..7b14bff228253117f7e846b4e115246c5ac74b5c 100644
--- a/components/open_from_clipboard/clipboard_recent_content_ios.mm
+++ b/components/open_from_clipboard/clipboard_recent_content_ios.mm
@@ -100,17 +100,14 @@ bool ClipboardRecentContentIOS::GetRecentURLFromClipboard(GURL* url) const {
}
void ClipboardRecentContentIOS::PasteboardChanged() {
- if ([UIPasteboard generalPasteboard].changeCount !=
- lastPasteboardChangeCount_) {
- urlFromPasteboardCache_ = URLFromPasteboard();
- if (!urlFromPasteboardCache_.is_empty()) {
- base::RecordAction(
- base::UserMetricsAction("MobileOmniboxClipboardChanged"));
- }
- lastPasteboardChangeDate_.reset([[NSDate date] retain]);
- lastPasteboardChangeCount_ = [UIPasteboard generalPasteboard].changeCount;
- SaveToUserDefaults();
+ urlFromPasteboardCache_ = URLFromPasteboard();
+ if (!urlFromPasteboardCache_.is_empty()) {
+ base::RecordAction(
+ base::UserMetricsAction("MobileOmniboxClipboardChanged"));
}
+ lastPasteboardChangeDate_.reset([[NSDate date] retain]);
+ lastPasteboardChangeCount_ = [UIPasteboard generalPasteboard].changeCount;
+ SaveToUserDefaults();
}
ClipboardRecentContentIOS::ClipboardRecentContentIOS()
@@ -124,7 +121,7 @@ ClipboardRecentContentIOS::ClipboardRecentContentIOS()
NSInteger changeCount = [UIPasteboard generalPasteboard].changeCount;
if (changeCount != lastPasteboardChangeCount_ ||
DeviceRestartedSincePasteboardChanged()) {
- PasteboardChanged();
+ PasteboardChanged();
}
notificationBridge_.reset(
[[PasteboardNotificationListenerBridge alloc] initWithDelegate:this]);

Powered by Google App Engine
This is Rietveld 408576698