| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
| 10 #include "base/win/windows_version.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 12 |
| 12 // The test is somewhat silly, because the Vista bots some have UAC enabled | 13 // The test is somewhat silly, because the Vista bots some have UAC enabled |
| 13 // and some have it disabled. At least we check that it does not crash. | 14 // and some have it disabled. At least we check that it does not crash. |
| 14 TEST(BaseWinUtilTest, TestIsUACEnabled) { | 15 TEST(BaseWinUtilTest, TestIsUACEnabled) { |
| 15 if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) { | 16 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
| 16 win_util::UserAccountControlIsEnabled(); | 17 win_util::UserAccountControlIsEnabled(); |
| 17 } else { | 18 } else { |
| 18 EXPECT_TRUE(win_util::UserAccountControlIsEnabled()); | 19 EXPECT_TRUE(win_util::UserAccountControlIsEnabled()); |
| 19 } | 20 } |
| 20 } | 21 } |
| 21 | 22 |
| 22 TEST(BaseWinUtilTest, TestGetUserSidString) { | 23 TEST(BaseWinUtilTest, TestGetUserSidString) { |
| 23 std::wstring user_sid; | 24 std::wstring user_sid; |
| 24 EXPECT_TRUE(win_util::GetUserSidString(&user_sid)); | 25 EXPECT_TRUE(win_util::GetUserSidString(&user_sid)); |
| 25 EXPECT_TRUE(!user_sid.empty()); | 26 EXPECT_TRUE(!user_sid.empty()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 ASSERT_TRUE(string_buffer); | 80 ASSERT_TRUE(string_buffer); |
| 80 | 81 |
| 81 // Verify the string is the same by different calls | 82 // Verify the string is the same by different calls |
| 82 EXPECT_EQ(win_util::FormatLastWin32Error(), std::wstring(string_buffer)); | 83 EXPECT_EQ(win_util::FormatLastWin32Error(), std::wstring(string_buffer)); |
| 83 EXPECT_EQ(win_util::FormatMessage(kAccessDeniedErrorCode), | 84 EXPECT_EQ(win_util::FormatMessage(kAccessDeniedErrorCode), |
| 84 std::wstring(string_buffer)); | 85 std::wstring(string_buffer)); |
| 85 | 86 |
| 86 // Done with the buffer allocated by ::FormatMessage() | 87 // Done with the buffer allocated by ::FormatMessage() |
| 87 LocalFree(string_buffer); | 88 LocalFree(string_buffer); |
| 88 } | 89 } |
| OLD | NEW |