diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-31 17:18:50 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-31 17:18:50 +0000 |
commit | a8e2058011129cbef38bf89834ee01715556b392 (patch) | |
tree | 00cb892894c52145a66d23048acf2a81f0eed61d /base/win/win_util_unittest.cc | |
parent | a1fa87c8042ed2a3f9edd74ad2f313c84b1e407a (diff) | |
download | chromium_src-a8e2058011129cbef38bf89834ee01715556b392.zip chromium_src-a8e2058011129cbef38bf89834ee01715556b392.tar.gz chromium_src-a8e2058011129cbef38bf89834ee01715556b392.tar.bz2 |
Move base/win_util to the base/win directory and use the base::win namespace.
Fix up includes, many files including base/win_util don't actually need it.
TEST=it compiles
BUG=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70341 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/win/win_util_unittest.cc')
-rw-r--r-- | base/win/win_util_unittest.cc | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/base/win/win_util_unittest.cc b/base/win/win_util_unittest.cc new file mode 100644 index 0000000..b79ed56 --- /dev/null +++ b/base/win/win_util_unittest.cc @@ -0,0 +1,58 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <windows.h> + +#include "base/basictypes.h" +#include "base/string_util.h" +#include "base/win/win_util.h" +#include "base/win/windows_version.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace base { +namespace win { + +namespace { + +// Saves the current thread's locale ID when initialized, and restores it when +// the instance is going out of scope. +class ThreadLocaleSaver { + public: + ThreadLocaleSaver() : original_locale_id_(GetThreadLocale()) {} + ~ThreadLocaleSaver() { SetThreadLocale(original_locale_id_); } + + private: + LCID original_locale_id_; + + DISALLOW_COPY_AND_ASSIGN(ThreadLocaleSaver); +}; + +} // namespace + +// The test is somewhat silly, because the Vista bots some have UAC enabled +// and some have it disabled. At least we check that it does not crash. +TEST(BaseWinUtilTest, TestIsUACEnabled) { + if (GetVersion() >= base::win::VERSION_VISTA) { + UserAccountControlIsEnabled(); + } else { + EXPECT_TRUE(UserAccountControlIsEnabled()); + } +} + +TEST(BaseWinUtilTest, TestGetUserSidString) { + std::wstring user_sid; + EXPECT_TRUE(GetUserSidString(&user_sid)); + EXPECT_TRUE(!user_sid.empty()); +} + +TEST(BaseWinUtilTest, TestGetNonClientMetrics) { + NONCLIENTMETRICS metrics = {0}; + GetNonClientMetrics(&metrics); + EXPECT_TRUE(metrics.cbSize > 0); + EXPECT_TRUE(metrics.iScrollWidth > 0); + EXPECT_TRUE(metrics.iScrollHeight > 0); +} + +} // namespace win +} // namespace base |