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

Unified Diff: ios/chrome/browser/reading_list/url_downloader_unittest.mm

Issue 2945803002: Use ContainsValue() instead of std::find() in ios/ (Closed)
Patch Set: Fixed compilation error. Created 3 years, 6 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: ios/chrome/browser/reading_list/url_downloader_unittest.mm
diff --git a/ios/chrome/browser/reading_list/url_downloader_unittest.mm b/ios/chrome/browser/reading_list/url_downloader_unittest.mm
index b6090b65cb6b358d97b141b67705d88955c89243..6905af9eb9e433e2f98b126445e2f911df6f8944 100644
--- a/ios/chrome/browser/reading_list/url_downloader_unittest.mm
+++ b/ios/chrome/browser/reading_list/url_downloader_unittest.mm
@@ -10,6 +10,7 @@
#import "base/mac/bind_objc_block.h"
#include "base/path_service.h"
#include "base/run_loop.h"
+#include "base/stl_util.h"
#import "base/test/ios/wait_util.h"
#include "components/reading_list/core/offline_url_utils.h"
#include "ios/chrome/browser/chrome_paths.h"
@@ -168,9 +169,7 @@ TEST_F(URLDownloaderTest, SingleDownload) {
downloader_->DownloadOfflineURL(url);
WaitUntilCondition(^bool {
- return std::find(downloader_->downloaded_files_.begin(),
- downloader_->downloaded_files_.end(),
- url) != downloader_->downloaded_files_.end();
+ return base::ContainsValue(downloader_->downloaded_files_, url);
});
ASSERT_TRUE(downloader_->CheckExistenceOfOfflineURLPagePath(url));
@@ -189,9 +188,7 @@ TEST_F(URLDownloaderTest, SingleDownloadRedirect) {
downloader_->DownloadOfflineURL(url);
WaitUntilCondition(^bool {
- return std::find(downloader_->downloaded_files_.begin(),
- downloader_->downloaded_files_.end(),
- url) != downloader_->downloaded_files_.end();
+ return base::ContainsValue(downloader_->downloaded_files_, url);
});
EXPECT_TRUE(downloader_->CheckExistenceOfOfflineURLPagePath(url));
@@ -229,14 +226,10 @@ TEST_F(URLDownloaderTest, DownloadAndRemove) {
downloader_->FakeEndWorking();
WaitUntilCondition(^bool {
- return std::find(downloader_->removed_files_.begin(),
- downloader_->removed_files_.end(),
- url) != downloader_->removed_files_.end();
+ return base::ContainsValue(downloader_->removed_files_, url);
});
- ASSERT_TRUE(std::find(downloader_->downloaded_files_.begin(),
- downloader_->downloaded_files_.end(),
- url) == downloader_->downloaded_files_.end());
+ ASSERT_TRUE(!base::ContainsValue(downloader_->downloaded_files_, url));
ASSERT_EQ(1ul, downloader_->downloaded_files_.size());
ASSERT_EQ(1ul, downloader_->removed_files_.size());
ASSERT_FALSE(downloader_->CheckExistenceOfOfflineURLPagePath(url));
@@ -253,17 +246,11 @@ TEST_F(URLDownloaderTest, DownloadAndRemoveAndRedownload) {
downloader_->FakeEndWorking();
WaitUntilCondition(^bool {
- return std::find(downloader_->removed_files_.begin(),
- downloader_->removed_files_.end(),
- url) != downloader_->removed_files_.end();
+ return base::ContainsValue(downloader_->removed_files_, url);
});
- ASSERT_TRUE(std::find(downloader_->downloaded_files_.begin(),
- downloader_->downloaded_files_.end(),
- url) != downloader_->downloaded_files_.end());
- ASSERT_TRUE(std::find(downloader_->removed_files_.begin(),
- downloader_->removed_files_.end(),
- url) != downloader_->removed_files_.end());
+ ASSERT_TRUE(base::ContainsValue(downloader_->downloaded_files_, url));
+ ASSERT_TRUE(base::ContainsValue(downloader_->removed_files_, url));
ASSERT_TRUE(downloader_->CheckExistenceOfOfflineURLPagePath(url));
}
« no previous file with comments | « ios/chrome/browser/reading_list/url_downloader.cc ('k') | ios/chrome/browser/ui/bookmarks/bookmark_collection_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698