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

Side by Side Diff: extensions/common/url_pattern_set_unittest.cc

Issue 2950263003: Use ContainsValue() instead of std::find() in extensions/ (Closed)
Patch Set: Rebase patch. 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 unified diff | Download patch
« no previous file with comments | « extensions/common/permissions/permissions_data.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "extensions/common/url_pattern_set.h" 5 #include "extensions/common/url_pattern_set.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <sstream> 9 #include <sstream>
10 10
11 #include "base/stl_util.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 namespace { 18 namespace {
18 19
19 void AddPattern(URLPatternSet* set, const std::string& pattern) { 20 void AddPattern(URLPatternSet* set, const std::string& pattern) {
20 int schemes = URLPattern::SCHEME_ALL; 21 int schemes = URLPattern::SCHEME_ALL;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 TEST(URLPatternSetTest, ToStringVector) { 461 TEST(URLPatternSetTest, ToStringVector) {
461 URLPatternSet set; 462 URLPatternSet set;
462 AddPattern(&set, "https://google.com/"); 463 AddPattern(&set, "https://google.com/");
463 AddPattern(&set, "https://google.com/"); 464 AddPattern(&set, "https://google.com/");
464 AddPattern(&set, "https://yahoo.com/"); 465 AddPattern(&set, "https://yahoo.com/");
465 466
466 std::unique_ptr<std::vector<std::string>> string_vector(set.ToStringVector()); 467 std::unique_ptr<std::vector<std::string>> string_vector(set.ToStringVector());
467 468
468 EXPECT_EQ(2UL, string_vector->size()); 469 EXPECT_EQ(2UL, string_vector->size());
469 470
470 const auto begin = string_vector->begin(); 471 EXPECT_TRUE(base::ContainsValue(*string_vector, "https://google.com/"));
471 const auto end = string_vector->end(); 472 EXPECT_TRUE(base::ContainsValue(*string_vector, "https://yahoo.com/"));
472
473 auto it = std::find(begin, end, "https://google.com/");
474 EXPECT_NE(it, end);
475 it = std::find(begin, end, "https://yahoo.com/");
476 EXPECT_NE(it, end);
477 } 473 }
478 474
479 } // namespace extensions 475 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/permissions/permissions_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698