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

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

Issue 1274123003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no media changes 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->clear(); 85 *attr_names = base::SplitString(string(buffer, len), std::string(1, '\0'),
86 base::SplitString(string(buffer, len), '\0', attr_names); 86 base::TRIM_WHITESPACE,
87 base::SPLIT_WANT_ALL);
87 delete[] buffer; 88 delete[] buffer;
88 } 89 }
89 90
90 void VerifyAttributesAreSetCorrectly() const { 91 void VerifyAttributesAreSetCorrectly() const {
91 vector<string> attr_names; 92 vector<string> attr_names;
92 GetExtendedAttributeNames(&attr_names); 93 GetExtendedAttributeNames(&attr_names);
93 94
94 // Check if the attributes are set on the file 95 // Check if the attributes are set on the file
95 vector<string>::const_iterator pos = find(attr_names.begin(), 96 vector<string>::const_iterator pos = find(attr_names.begin(),
96 attr_names.end(), kSourceURLAttrName); 97 attr_names.end(), kSourceURLAttrName);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 AddOriginMetadataToFile(test_file(), invalid_url, invalid_url); 155 AddOriginMetadataToFile(test_file(), invalid_url, invalid_url);
155 GetExtendedAttributeNames(&attr_names); 156 GetExtendedAttributeNames(&attr_names);
156 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(), 157 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(),
157 kSourceURLAttrName)); 158 kSourceURLAttrName));
158 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(), 159 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(),
159 kReferrerURLAttrName)); 160 kReferrerURLAttrName));
160 } 161 }
161 162
162 } // namespace 163 } // namespace
163 } // namespace content 164 } // 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