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

Unified Diff: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc

Issue 2961033002: Use ContainsValue() instead of std::find() in chrome/browser/extensions (Closed)
Patch Set: Reverted code changes in language_settings_private_api.cc:307 Created 3 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
Index: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
index 7319aa86e399a38d6007a40fe5cd5a93c138918b..944e035c9cfa0b4bdbc8e0f41dc6737511645749 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -109,14 +109,6 @@ static void EventHandledOnIOThread(
response);
}
-// Searches |key| in |collection| by iterating over its elements and returns
-// true if found.
-template <typename Collection, typename Key>
-bool Contains(const Collection& collection, const Key& key) {
- return std::find(collection.begin(), collection.end(), key) !=
- collection.end();
-}
-
// Returns whether |warnings| contains an extension for |extension_id|.
bool HasWarning(const WarningSet& warnings,
const std::string& extension_id) {
@@ -1513,15 +1505,15 @@ TEST(ExtensionWebRequestHelpersTest, TestCalculateOnHeadersReceivedDelta) {
ASSERT_TRUE(delta.get());
EXPECT_TRUE(delta->cancel);
EXPECT_EQ(2u, delta->added_response_headers.size());
- EXPECT_TRUE(Contains(delta->added_response_headers,
- ResponseHeader("Key2", "Value1")));
- EXPECT_TRUE(Contains(delta->added_response_headers,
- ResponseHeader("Key4", "Value4")));
+ EXPECT_TRUE(base::ContainsValue(delta->added_response_headers,
+ ResponseHeader("Key2", "Value1")));
+ EXPECT_TRUE(base::ContainsValue(delta->added_response_headers,
+ ResponseHeader("Key4", "Value4")));
EXPECT_EQ(2u, delta->deleted_response_headers.size());
- EXPECT_TRUE(Contains(delta->deleted_response_headers,
- ResponseHeader("Key2", "Value2, Bar")));
- EXPECT_TRUE(Contains(delta->deleted_response_headers,
- ResponseHeader("Key3", "Value3")));
+ EXPECT_TRUE(base::ContainsValue(delta->deleted_response_headers,
+ ResponseHeader("Key2", "Value2, Bar")));
+ EXPECT_TRUE(base::ContainsValue(delta->deleted_response_headers,
+ ResponseHeader("Key3", "Value3")));
}
TEST(ExtensionWebRequestHelpersTest, TestCalculateOnAuthRequiredDelta) {

Powered by Google App Engine
This is Rietveld 408576698