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

Side by Side Diff: base/win_util_unittest.cc

Issue 28128: Fix all places where we used the GetWinVersion function... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/win_util.cc ('k') | chrome/app/chrome_exe_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 8 #include "base/registry.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/win_util.h" 10 #include "base/win_util.h"
(...skipping 29 matching lines...) Expand all
40 language_key.ReadValue(L"InstallLanguage", &language); 40 language_key.ReadValue(L"InstallLanguage", &language);
41 } 41 }
42 wchar_t * unused_endptr; 42 wchar_t * unused_endptr;
43 return PRIMARYLANGID(wcstol(language.c_str(), &unused_endptr, 16)); 43 return PRIMARYLANGID(wcstol(language.c_str(), &unused_endptr, 16));
44 } 44 }
45 }; 45 };
46 46
47 // The test is somewhat silly, because the Vista bots some have UAC enabled 47 // The test is somewhat silly, because the Vista bots some have UAC enabled
48 // and some have it disabled. At least we check that it does not crash. 48 // and some have it disabled. At least we check that it does not crash.
49 TEST_F(BaseWinUtilTest, TestIsUACEnabled) { 49 TEST_F(BaseWinUtilTest, TestIsUACEnabled) {
50 if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA) { 50 if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) {
51 win_util::UserAccountControlIsEnabled(); 51 win_util::UserAccountControlIsEnabled();
52 } else { 52 } else {
53 EXPECT_TRUE(win_util::UserAccountControlIsEnabled()); 53 EXPECT_TRUE(win_util::UserAccountControlIsEnabled());
54 } 54 }
55 } 55 }
56 56
57 TEST_F(BaseWinUtilTest, TestGetUserSidString) { 57 TEST_F(BaseWinUtilTest, TestGetUserSidString) {
58 std::wstring user_sid; 58 std::wstring user_sid;
59 EXPECT_TRUE(win_util::GetUserSidString(&user_sid)); 59 EXPECT_TRUE(win_util::GetUserSidString(&user_sid));
60 EXPECT_TRUE(!user_sid.empty()); 60 EXPECT_TRUE(!user_sid.empty());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 ASSERT_TRUE(string_buffer); 103 ASSERT_TRUE(string_buffer);
104 104
105 // Verify the string is the same by different calls 105 // Verify the string is the same by different calls
106 EXPECT_EQ(win_util::FormatLastWin32Error(), std::wstring(string_buffer)); 106 EXPECT_EQ(win_util::FormatLastWin32Error(), std::wstring(string_buffer));
107 EXPECT_EQ(win_util::FormatMessage(kAccessDeniedErrorCode), 107 EXPECT_EQ(win_util::FormatMessage(kAccessDeniedErrorCode),
108 std::wstring(string_buffer)); 108 std::wstring(string_buffer));
109 109
110 // Done with the buffer allocated by ::FormatMessage() 110 // Done with the buffer allocated by ::FormatMessage()
111 LocalFree(string_buffer); 111 LocalFree(string_buffer);
112 } 112 }
OLDNEW
« no previous file with comments | « base/win_util.cc ('k') | chrome/app/chrome_exe_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698