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

Side by Side Diff: components/domain_reliability/header_unittest.cc

Issue 2613223002: Remove ScopedVector from base::JSONValueConverter (Closed)
Patch Set: Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/domain_reliability/header.h" 5 #include "components/domain_reliability/header.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "components/domain_reliability/config.h" 10 #include "components/domain_reliability/config.h"
(...skipping 10 matching lines...) Expand all
21 void Parse(std::string value) { 21 void Parse(std::string value) {
22 parsed_ = DomainReliabilityHeader::Parse(value); 22 parsed_ = DomainReliabilityHeader::Parse(value);
23 } 23 }
24 24
25 const DomainReliabilityHeader* parsed() const { return parsed_.get(); } 25 const DomainReliabilityHeader* parsed() const { return parsed_.get(); }
26 26
27 private: 27 private:
28 std::unique_ptr<DomainReliabilityHeader> parsed_; 28 std::unique_ptr<DomainReliabilityHeader> parsed_;
29 }; 29 };
30 30
31 bool CheckReportUris(const char* pipe_separated_expected_report_uris, 31 bool CheckReportUris(
32 const ScopedVector<GURL>& actual_report_uris) { 32 const char* pipe_separated_expected_report_uris,
33 const std::vector<std::unique_ptr<GURL>>& actual_report_uris) {
33 if (!pipe_separated_expected_report_uris) 34 if (!pipe_separated_expected_report_uris)
34 return actual_report_uris.empty(); 35 return actual_report_uris.empty();
35 36
36 std::vector<std::string> expected_report_uri_strings = 37 std::vector<std::string> expected_report_uri_strings =
37 SplitString(pipe_separated_expected_report_uris, 38 SplitString(pipe_separated_expected_report_uris,
38 "|", 39 "|",
39 base::KEEP_WHITESPACE, 40 base::KEEP_WHITESPACE,
40 base::SPLIT_WANT_ALL); 41 base::SPLIT_WANT_ALL);
41 if (expected_report_uri_strings.size() != actual_report_uris.size()) 42 if (expected_report_uri_strings.size() != actual_report_uris.size())
42 return false; 43 return false;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 for (const auto& test_case : test_cases) { 149 for (const auto& test_case : test_cases) {
149 Parse(test_case.header); 150 Parse(test_case.header);
150 EXPECT_TRUE(parsed()->IsParseError()) 151 EXPECT_TRUE(parsed()->IsParseError())
151 << "Invalid NEL header \"" << test_case.header << "\" (" 152 << "Invalid NEL header \"" << test_case.header << "\" ("
152 << test_case.description << ") incorrectly parsed as valid."; 153 << test_case.description << ") incorrectly parsed as valid.";
153 } 154 }
154 } 155 }
155 156
156 } // namespace 157 } // namespace
157 } // namespace domain_reliability 158 } // namespace domain_reliability
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698