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

Side by Side Diff: content/common/sandbox_mac_diraccess_unittest.mm

Issue 121033002: Update uses of UTF conversions in content/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « content/common/plugin_list_unittest.cc ('k') | content/common/webplugininfo_unittest.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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 #include <dirent.h> 6 #include <dirent.h>
7 7
8 extern "C" { 8 extern "C" {
9 #include <sandbox.h> 9 #include <sandbox.h>
10 } 10 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 EXPECT_TRUE(Sandbox::QuoteStringForRegex(ok_string, &out)); 92 EXPECT_TRUE(Sandbox::QuoteStringForRegex(ok_string, &out));
93 } 93 }
94 94
95 // Check that all characters whose values are larger than 126 [7E] are 95 // Check that all characters whose values are larger than 126 [7E] are
96 // rejected by the regex escaping code. 96 // rejected by the regex escaping code.
97 { 97 {
98 std::string out; 98 std::string out;
99 EXPECT_TRUE(Sandbox::QuoteStringForRegex("}", &out)); // } == 0x7D == 125 99 EXPECT_TRUE(Sandbox::QuoteStringForRegex("}", &out)); // } == 0x7D == 125
100 EXPECT_FALSE(Sandbox::QuoteStringForRegex("~", &out)); // ~ == 0x7E == 126 100 EXPECT_FALSE(Sandbox::QuoteStringForRegex("~", &out)); // ~ == 0x7E == 126
101 EXPECT_FALSE( 101 EXPECT_FALSE(
102 Sandbox::QuoteStringForRegex(WideToUTF8(L"^\u2135.\u2136$"), &out)); 102 Sandbox::QuoteStringForRegex(base::WideToUTF8(L"^\u2135.\u2136$"),
103 &out));
103 } 104 }
104 105
105 { 106 {
106 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(regex_cases); ++i) { 107 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(regex_cases); ++i) {
107 std::string out; 108 std::string out;
108 std::string in = WideToUTF8(regex_cases[i].to_escape); 109 std::string in = base::WideToUTF8(regex_cases[i].to_escape);
109 EXPECT_TRUE(Sandbox::QuoteStringForRegex(in, &out)); 110 EXPECT_TRUE(Sandbox::QuoteStringForRegex(in, &out));
110 std::string expected("^"); 111 std::string expected("^");
111 expected.append(regex_cases[i].escaped); 112 expected.append(regex_cases[i].escaped);
112 expected.append(kSandboxEscapeSuffix); 113 expected.append(kSandboxEscapeSuffix);
113 EXPECT_EQ(expected, out); 114 EXPECT_EQ(expected, out);
114 } 115 }
115 } 116 }
116 117
117 { 118 {
118 std::string in_utf8("\\^.$|()[]*+?{}"); 119 std::string in_utf8("\\^.$|()[]*+?{}");
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 PLOG(ERROR) << "Sandbox breach: was able to write (" 304 PLOG(ERROR) << "Sandbox breach: was able to write ("
304 << denied_file2.value() 305 << denied_file2.value()
305 << ")"; 306 << ")";
306 return -1; 307 return -1;
307 } 308 }
308 309
309 return 0; 310 return 0;
310 } 311 }
311 312
312 } // namespace content 313 } // namespace content
OLDNEW
« no previous file with comments | « content/common/plugin_list_unittest.cc ('k') | content/common/webplugininfo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698