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