| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "components/open_from_clipboard/clipboard_recent_content_ios.h" | 5 #include "components/open_from_clipboard/clipboard_recent_content_ios.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 base::TimeDelta::FromSeconds(0)); | 39 base::TimeDelta::FromSeconds(0)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void ResetClipboardRecentContent(const std::string& application_scheme, | 42 void ResetClipboardRecentContent(const std::string& application_scheme, |
| 43 base::TimeDelta time_delta) { | 43 base::TimeDelta time_delta) { |
| 44 clipboard_content_.reset( | 44 clipboard_content_.reset( |
| 45 new ClipboardRecentContentIOS(application_scheme, time_delta)); | 45 new ClipboardRecentContentIOS(application_scheme, time_delta)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void SetStoredPasteboardChangeDate(NSDate* changeDate) { | 48 void SetStoredPasteboardChangeDate(NSDate* changeDate) { |
| 49 clipboard_content_->lastPasteboardChangeDate_.reset([changeDate copy]); | 49 clipboard_content_->last_pasteboard_change_date_.reset([changeDate copy]); |
| 50 clipboard_content_->SaveToUserDefaults(); | 50 clipboard_content_->SaveToUserDefaults(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void SetStoredPasteboardChangeCount(NSInteger newChangeCount) { | 53 void SetStoredPasteboardChangeCount(NSInteger newChangeCount) { |
| 54 clipboard_content_->lastPasteboardChangeCount_ = newChangeCount; | 54 clipboard_content_->last_pasteboard_change_count_ = newChangeCount; |
| 55 clipboard_content_->SaveToUserDefaults(); | 55 clipboard_content_->SaveToUserDefaults(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 scoped_ptr<ClipboardRecentContentIOS> clipboard_content_; | 59 scoped_ptr<ClipboardRecentContentIOS> clipboard_content_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 TEST_F(ClipboardRecentContentIOSTest, SchemeFiltering) { | 62 TEST_F(ClipboardRecentContentIOSTest, SchemeFiltering) { |
| 63 GURL gurl; | 63 GURL gurl; |
| 64 | 64 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Check that the even if the device is restarted, pasteboard content is | 137 // Check that the even if the device is restarted, pasteboard content is |
| 138 // still suppressed. | 138 // still suppressed. |
| 139 SimulateDeviceRestart(); | 139 SimulateDeviceRestart(); |
| 140 EXPECT_FALSE(clipboard_content_->GetRecentURLFromClipboard(&gurl)); | 140 EXPECT_FALSE(clipboard_content_->GetRecentURLFromClipboard(&gurl)); |
| 141 | 141 |
| 142 // Check that if the pasteboard changes, the new content is not | 142 // Check that if the pasteboard changes, the new content is not |
| 143 // supressed anymore. | 143 // supressed anymore. |
| 144 SetPasteboardContent(kRecognizedURL); | 144 SetPasteboardContent(kRecognizedURL); |
| 145 EXPECT_TRUE(clipboard_content_->GetRecentURLFromClipboard(&gurl)); | 145 EXPECT_TRUE(clipboard_content_->GetRecentURLFromClipboard(&gurl)); |
| 146 } | 146 } |
| OLD | NEW |