OLD | NEW |
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 Loading... |
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 |
OLD | NEW |