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

Side by Side Diff: content/browser/download/file_metadata_unittest_linux.cc

Issue 1278973003: Revert of Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « content/browser/browser_main_loop.cc ('k') | content/browser/download/save_package.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 <errno.h> 5 #include <errno.h>
6 #include <sys/types.h> 6 #include <sys/types.h>
7 #include <sys/xattr.h> 7 #include <sys/xattr.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <sstream> 10 #include <sstream>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 string real_value(buffer, len); 75 string real_value(buffer, len);
76 delete[] buffer; 76 delete[] buffer;
77 EXPECT_EQ(expected_value, real_value); 77 EXPECT_EQ(expected_value, real_value);
78 } 78 }
79 79
80 void GetExtendedAttributeNames(vector<string>* attr_names) const { 80 void GetExtendedAttributeNames(vector<string>* attr_names) const {
81 ssize_t len = listxattr(test_file().value().c_str(), NULL, 0); 81 ssize_t len = listxattr(test_file().value().c_str(), NULL, 0);
82 if (len <= static_cast<ssize_t>(0)) return; 82 if (len <= static_cast<ssize_t>(0)) return;
83 char* buffer = new char[len]; 83 char* buffer = new char[len];
84 len = listxattr(test_file().value().c_str(), buffer, len); 84 len = listxattr(test_file().value().c_str(), buffer, len);
85 *attr_names = base::SplitString(string(buffer, len), std::string(1, '\0'), 85 attr_names->clear();
86 base::TRIM_WHITESPACE, 86 base::SplitString(string(buffer, len), '\0', attr_names);
87 base::SPLIT_WANT_ALL);
88 delete[] buffer; 87 delete[] buffer;
89 } 88 }
90 89
91 void VerifyAttributesAreSetCorrectly() const { 90 void VerifyAttributesAreSetCorrectly() const {
92 vector<string> attr_names; 91 vector<string> attr_names;
93 GetExtendedAttributeNames(&attr_names); 92 GetExtendedAttributeNames(&attr_names);
94 93
95 // Check if the attributes are set on the file 94 // Check if the attributes are set on the file
96 vector<string>::const_iterator pos = find(attr_names.begin(), 95 vector<string>::const_iterator pos = find(attr_names.begin(),
97 attr_names.end(), kSourceURLAttrName); 96 attr_names.end(), kSourceURLAttrName);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 AddOriginMetadataToFile(test_file(), invalid_url, invalid_url); 154 AddOriginMetadataToFile(test_file(), invalid_url, invalid_url);
156 GetExtendedAttributeNames(&attr_names); 155 GetExtendedAttributeNames(&attr_names);
157 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(), 156 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(),
158 kSourceURLAttrName)); 157 kSourceURLAttrName));
159 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(), 158 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(),
160 kReferrerURLAttrName)); 159 kReferrerURLAttrName));
161 } 160 }
162 161
163 } // namespace 162 } // namespace
164 } // namespace content 163 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698