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

Side by Side Diff: components/subresource_filter/core/common/test_ruleset_creator.cc

Issue 2691393002: Fix auto raw pointer deduction on linux (Closed)
Patch Set: rebase Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/subresource_filter/core/common/test_ruleset_creator.h" 5 #include "components/subresource_filter/core/common/test_ruleset_creator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 23 matching lines...) Expand all
34 34
35 std::vector<uint8_t> SerializeUnindexedRulesetWithMultipleRules( 35 std::vector<uint8_t> SerializeUnindexedRulesetWithMultipleRules(
36 const std::vector<proto::UrlRule>& rules) { 36 const std::vector<proto::UrlRule>& rules) {
37 std::string ruleset_contents; 37 std::string ruleset_contents;
38 google::protobuf::io::StringOutputStream output(&ruleset_contents); 38 google::protobuf::io::StringOutputStream output(&ruleset_contents);
39 UnindexedRulesetWriter ruleset_writer(&output); 39 UnindexedRulesetWriter ruleset_writer(&output);
40 for (const auto& rule : rules) 40 for (const auto& rule : rules)
41 ruleset_writer.AddUrlRule(rule); 41 ruleset_writer.AddUrlRule(rule);
42 ruleset_writer.Finish(); 42 ruleset_writer.Finish();
43 43
44 auto data = reinterpret_cast<const uint8_t*>(ruleset_contents.data()); 44 auto* data = reinterpret_cast<const uint8_t*>(ruleset_contents.data());
45 return std::vector<uint8_t>(data, data + ruleset_contents.size()); 45 return std::vector<uint8_t>(data, data + ruleset_contents.size());
46 } 46 }
47 47
48 std::vector<uint8_t> SerializeUnindexedRulesetWithSingleRule( 48 std::vector<uint8_t> SerializeUnindexedRulesetWithSingleRule(
49 const proto::UrlRule& rule) { 49 const proto::UrlRule& rule) {
50 return SerializeUnindexedRulesetWithMultipleRules({rule}); 50 return SerializeUnindexedRulesetWithMultipleRules({rule});
51 } 51 }
52 52
53 std::vector<uint8_t> SerializeIndexedRulesetWithMultipleRules( 53 std::vector<uint8_t> SerializeIndexedRulesetWithMultipleRules(
54 const std::vector<proto::UrlRule>& rules) { 54 const std::vector<proto::UrlRule>& rules) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 TestRuleset* ruleset) { 170 TestRuleset* ruleset) {
171 DCHECK(ruleset); 171 DCHECK(ruleset);
172 172
173 ruleset->contents = std::move(ruleset_contents); 173 ruleset->contents = std::move(ruleset_contents);
174 ASSERT_NO_FATAL_FAILURE(GetUniqueTemporaryPath(&ruleset->path)); 174 ASSERT_NO_FATAL_FAILURE(GetUniqueTemporaryPath(&ruleset->path));
175 WriteRulesetContents(ruleset->contents, ruleset->path); 175 WriteRulesetContents(ruleset->contents, ruleset->path);
176 } 176 }
177 177
178 } // namespace testing 178 } // namespace testing
179 } // namespace subresource_filter 179 } // namespace subresource_filter
OLDNEW
« no previous file with comments | « components/subresource_filter/core/common/first_party_origin_unittest.cc ('k') | components/toolbar/toolbar_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698