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

Side by Side Diff: components/url_matcher/url_matcher_factory_unittest.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/url_matcher/url_matcher_factory.h" 5 #include "components/url_matcher/url_matcher_factory.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10 #include <utility>
11
9 #include "base/format_macros.h" 12 #include "base/format_macros.h"
10 #include "base/macros.h" 13 #include "base/macros.h"
11 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
12 #include "base/values.h" 15 #include "base/values.h"
13 #include "components/url_matcher/url_matcher_constants.h" 16 #include "components/url_matcher/url_matcher_constants.h"
14 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
15 #include "url/gurl.h" 18 #include "url/gurl.h"
16 19
17 namespace url_matcher { 20 namespace url_matcher {
18 21
(...skipping 23 matching lines...) Expand all
42 45
43 // Valid values: 46 // Valid values:
44 // { 47 // {
45 // "port_range": [80, [1000, 1010]], 48 // "port_range": [80, [1000, 1010]],
46 // "schemes": ["http"], 49 // "schemes": ["http"],
47 // "hostSuffix": "example.com" 50 // "hostSuffix": "example.com"
48 // "hostPrefix": "www" 51 // "hostPrefix": "www"
49 // } 52 // }
50 53
51 // Port range: Allow 80;1000-1010. 54 // Port range: Allow 80;1000-1010.
52 base::ListValue* port_range = new base::ListValue(); 55 std::unique_ptr<base::ListValue> port_range(new base::ListValue());
53 port_range->AppendInteger(1000); 56 port_range->AppendInteger(1000);
54 port_range->AppendInteger(1010); 57 port_range->AppendInteger(1010);
55 base::ListValue* port_ranges = new base::ListValue(); 58 base::ListValue* port_ranges = new base::ListValue();
56 port_ranges->AppendInteger(80); 59 port_ranges->AppendInteger(80);
57 port_ranges->Append(port_range); 60 port_ranges->Append(std::move(port_range));
58 61
59 base::ListValue* scheme_list = new base::ListValue(); 62 base::ListValue* scheme_list = new base::ListValue();
60 scheme_list->AppendString("http"); 63 scheme_list->AppendString("http");
61 64
62 base::DictionaryValue valid_condition; 65 base::DictionaryValue valid_condition;
63 valid_condition.SetString(keys::kHostSuffixKey, "example.com"); 66 valid_condition.SetString(keys::kHostSuffixKey, "example.com");
64 valid_condition.SetString(keys::kHostPrefixKey, "www"); 67 valid_condition.SetString(keys::kHostPrefixKey, "www");
65 valid_condition.Set(keys::kPortsKey, port_ranges); 68 valid_condition.Set(keys::kPortsKey, port_ranges);
66 valid_condition.Set(keys::kSchemesKey, scheme_list); 69 valid_condition.Set(keys::kSchemesKey, scheme_list);
67 70
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 kIsUrlCaseSensitive, kIsUrlLowerCaseEnforced, url), 335 kIsUrlCaseSensitive, kIsUrlLowerCaseEnforced, url),
333 }; 336 };
334 337
335 for (size_t i = 0; i < arraysize(case_tests); ++i) { 338 for (size_t i = 0; i < arraysize(case_tests); ++i) {
336 SCOPED_TRACE(base::StringPrintf("Iteration: %" PRIuS, i)); 339 SCOPED_TRACE(base::StringPrintf("Iteration: %" PRIuS, i));
337 case_tests[i].Test(); 340 case_tests[i].Test();
338 } 341 }
339 } 342 }
340 343
341 } // namespace url_matcher 344 } // namespace url_matcher
OLDNEW
« no previous file with comments | « components/sync_driver/about_sync_util.cc ('k') | content/browser/geolocation/network_location_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698