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