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

Unified Diff: base/win_util_unittest.cc

Issue 6019007: Remove win_util::FormatMessage and FormatLastWin32Error. These were only used... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | « base/win_util.cc ('k') | chrome/browser/aeropeek_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win_util_unittest.cc
===================================================================
--- base/win_util_unittest.cc (revision 70263)
+++ base/win_util_unittest.cc (working copy)
@@ -50,40 +50,3 @@
};
} // namespace
-
-TEST(BaseWinUtilTest, FormatMessage) {
- // Because we cannot write tests of every language, we only test the message
- // of en-US locale. Here, we change the current locale temporarily.
- ThreadLocaleSaver thread_locale_saver;
- WORD language_id = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
- LCID locale_id = MAKELCID(language_id, SORT_DEFAULT);
- ASSERT_TRUE(SetThreadLocale(locale_id));
-
- const int kAccessDeniedErrorCode = 5;
- SetLastError(kAccessDeniedErrorCode);
- ASSERT_EQ(GetLastError(), kAccessDeniedErrorCode);
- std::wstring value;
- TrimWhitespace(win_util::FormatLastWin32Error(), TRIM_ALL, &value);
- EXPECT_EQ(std::wstring(L"Access is denied."), value);
-
- // Manually call the OS function
- wchar_t * string_buffer = NULL;
- unsigned string_length =
- ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
- kAccessDeniedErrorCode, 0,
- reinterpret_cast<wchar_t *>(&string_buffer), 0, NULL);
-
- // Verify the call succeeded
- ASSERT_TRUE(string_length);
- ASSERT_TRUE(string_buffer);
-
- // Verify the string is the same by different calls
- EXPECT_EQ(win_util::FormatLastWin32Error(), std::wstring(string_buffer));
- EXPECT_EQ(win_util::FormatMessage(kAccessDeniedErrorCode),
- std::wstring(string_buffer));
-
- // Done with the buffer allocated by ::FormatMessage()
- LocalFree(string_buffer);
-}
« no previous file with comments | « base/win_util.cc ('k') | chrome/browser/aeropeek_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698