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

Unified Diff: sandbox/win/tests/validation_tests/commands.cc

Issue 109843003: Replace wstring with string16 in sandbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/win/tests/validation_tests/commands.h ('k') | sandbox/win/wow_helper/wow_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/tests/validation_tests/commands.cc
diff --git a/sandbox/win/tests/validation_tests/commands.cc b/sandbox/win/tests/validation_tests/commands.cc
index dcdd4338da5177123867f6145b8f422db5567c5b..eefc498c6e3882bd85efa2dc17227d9f71bf9f4d 100644
--- a/sandbox/win/tests/validation_tests/commands.cc
+++ b/sandbox/win/tests/validation_tests/commands.cc
@@ -13,7 +13,7 @@ namespace {
// Returns the HKEY corresponding to name. If there is no HKEY corresponding
// to the name it returns NULL.
-HKEY GetHKEYFromString(const std::wstring &name) {
+HKEY GetHKEYFromString(const base::string16 &name) {
if (L"HKLM" == name)
return HKEY_LOCAL_MACHINE;
else if (L"HKCR" == name)
@@ -29,17 +29,17 @@ HKEY GetHKEYFromString(const std::wstring &name) {
}
// Modifies string to remove the leading and trailing quotes.
-void trim_quote(std::wstring* string) {
- std::wstring::size_type pos1 = string->find_first_not_of(L'"');
- std::wstring::size_type pos2 = string->find_last_not_of(L'"');
+void trim_quote(base::string16* string) {
+ base::string16::size_type pos1 = string->find_first_not_of(L'"');
+ base::string16::size_type pos2 = string->find_last_not_of(L'"');
- if (std::wstring::npos == pos1 || std::wstring::npos == pos2)
+ if (base::string16::npos == pos1 || base::string16::npos == pos2)
(*string) = L"";
else
(*string) = string->substr(pos1, pos2 + 1);
}
-int TestOpenFile(std::wstring path, bool for_write) {
+int TestOpenFile(base::string16 path, bool for_write) {
wchar_t path_expanded[MAX_PATH + 1] = {0};
DWORD size = ::ExpandEnvironmentStrings(path.c_str(), path_expanded,
MAX_PATH);
@@ -142,13 +142,13 @@ SBOX_TESTS_COMMAND int OpenFile(int argc, wchar_t **argv) {
if (1 != argc)
return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
- std::wstring path = argv[0];
+ base::string16 path = argv[0];
trim_quote(&path);
return TestOpenReadFile(path);
}
-int TestOpenReadFile(const std::wstring& path) {
+int TestOpenReadFile(const base::string16& path) {
return TestOpenFile(path, false);
}
@@ -156,13 +156,13 @@ int TestOpenWriteFile(int argc, wchar_t **argv) {
if (1 != argc)
return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
- std::wstring path = argv[0];
+ base::string16 path = argv[0];
trim_quote(&path);
return TestOpenWriteFile(path);
}
-int TestOpenWriteFile(const std::wstring& path) {
+int TestOpenWriteFile(const base::string16& path) {
return TestOpenFile(path, true);
}
@@ -174,7 +174,7 @@ SBOX_TESTS_COMMAND int OpenKey(int argc, wchar_t **argv) {
HKEY base_key = GetHKEYFromString(argv[0]);
// Get the subkey.
- std::wstring subkey;
+ base::string16 subkey;
if (2 == argc) {
subkey = argv[1];
trim_quote(&subkey);
@@ -183,7 +183,7 @@ SBOX_TESTS_COMMAND int OpenKey(int argc, wchar_t **argv) {
return TestOpenKey(base_key, subkey);
}
-int TestOpenKey(HKEY base_key, std::wstring subkey) {
+int TestOpenKey(HKEY base_key, base::string16 subkey) {
HKEY key;
LONG err_code = ::RegOpenKeyEx(base_key,
subkey.c_str(),
« no previous file with comments | « sandbox/win/tests/validation_tests/commands.h ('k') | sandbox/win/wow_helper/wow_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698