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

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

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 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/url_pattern_set.cc ('k') | extensions/common/url_pattern_unittest.cc » ('j') | 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
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 std::vector<std::string> patterns; 280 std::vector<std::string> patterns;
281 patterns.push_back("http://www.google.com/*"); 281 patterns.push_back("http://www.google.com/*");
282 patterns.push_back("http://www.yahoo.com/*"); 282 patterns.push_back("http://www.yahoo.com/*");
283 283
284 for (size_t i = 0; i < patterns.size(); ++i) 284 for (size_t i = 0; i < patterns.size(); ++i)
285 AddPattern(&set1, patterns[i]); 285 AddPattern(&set1, patterns[i]);
286 286
287 std::string error; 287 std::string error;
288 bool allow_file_access = false; 288 bool allow_file_access = false;
289 scoped_ptr<base::ListValue> value(set1.ToValue()); 289 std::unique_ptr<base::ListValue> value(set1.ToValue());
290 set2.Populate(*value, URLPattern::SCHEME_ALL, allow_file_access, &error); 290 set2.Populate(*value, URLPattern::SCHEME_ALL, allow_file_access, &error);
291 EXPECT_EQ(set1, set2); 291 EXPECT_EQ(set1, set2);
292 292
293 set2.ClearPatterns(); 293 set2.ClearPatterns();
294 set2.Populate(patterns, URLPattern::SCHEME_ALL, allow_file_access, &error); 294 set2.Populate(patterns, URLPattern::SCHEME_ALL, allow_file_access, &error);
295 EXPECT_EQ(set1, set2); 295 EXPECT_EQ(set1, set2);
296 } 296 }
297 297
298 TEST(URLPatternSetTest, NwayUnion) { 298 TEST(URLPatternSetTest, NwayUnion) {
299 std::string google_a = "http://www.google.com/a*"; 299 std::string google_a = "http://www.google.com/a*";
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 EXPECT_FALSE(set.AddOrigin( 456 EXPECT_FALSE(set.AddOrigin(
457 URLPattern::SCHEME_HTTP, GURL("https://google.com/"))); 457 URLPattern::SCHEME_HTTP, GURL("https://google.com/")));
458 } 458 }
459 459
460 TEST(URLPatternSetTest, ToStringVector) { 460 TEST(URLPatternSetTest, ToStringVector) {
461 URLPatternSet set; 461 URLPatternSet set;
462 AddPattern(&set, "https://google.com/"); 462 AddPattern(&set, "https://google.com/");
463 AddPattern(&set, "https://google.com/"); 463 AddPattern(&set, "https://google.com/");
464 AddPattern(&set, "https://yahoo.com/"); 464 AddPattern(&set, "https://yahoo.com/");
465 465
466 scoped_ptr<std::vector<std::string>> string_vector(set.ToStringVector()); 466 std::unique_ptr<std::vector<std::string>> string_vector(set.ToStringVector());
467 467
468 EXPECT_EQ(2UL, string_vector->size()); 468 EXPECT_EQ(2UL, string_vector->size());
469 469
470 const auto begin = string_vector->begin(); 470 const auto begin = string_vector->begin();
471 const auto end = string_vector->end(); 471 const auto end = string_vector->end();
472 472
473 auto it = std::find(begin, end, "https://google.com/"); 473 auto it = std::find(begin, end, "https://google.com/");
474 EXPECT_NE(it, end); 474 EXPECT_NE(it, end);
475 it = std::find(begin, end, "https://yahoo.com/"); 475 it = std::find(begin, end, "https://yahoo.com/");
476 EXPECT_NE(it, end); 476 EXPECT_NE(it, end);
477 } 477 }
478 478
479 } // namespace extensions 479 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/url_pattern_set.cc ('k') | extensions/common/url_pattern_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698