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

Side by Side Diff: base/vistautil_unittest.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « base/vistautil.cc ('k') | base/window_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2008-2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16 #include <shlobj.h>
17 #include "omaha/base/reg_key.h"
18 #include "omaha/base/vistautil.h"
19 #include "omaha/testing/unit_test.h"
20
21 namespace omaha {
22
23 namespace vista_util {
24
25 TEST(VistaUtilTest, IsUserAdmin) {
26 bool is_admin = !!::IsUserAnAdmin();
27 EXPECT_EQ(is_admin, IsUserAdmin());
28 }
29
30 // Tests the code returns true if Vista or later.
31 TEST(VistaUtilTest, IsUACMaybeOn) {
32 if (!IsVistaOrLater()) {
33 std::wcout << _T("\tSkipping test because not running on Vista or later.")
34 << std::endl;
35 return;
36 }
37
38 bool is_uac_maybe_on = false;
39
40 bool is_split_token = false;
41 if (SUCCEEDED(IsUserRunningSplitToken(&is_split_token)) && is_split_token) {
42 is_uac_maybe_on = true;
43 } else {
44 const TCHAR* key_name = _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\")
45 _T("CurrentVersion\\Policies\\System");
46
47 DWORD enable_lua = 0;
48 is_uac_maybe_on =
49 FAILED(RegKey::GetValue(key_name, _T("EnableLUA"), &enable_lua)) ||
50 enable_lua;
51 }
52
53 EXPECT_EQ(is_uac_maybe_on, IsUACMaybeOn());
54 }
55
56 TEST(VistaUtilTest, IsElevatedWithUACMaybeOn) {
57 EXPECT_EQ(IsUserAdmin() && IsVistaOrLater() && IsUACMaybeOn(),
58 IsElevatedWithUACMaybeOn());
59 }
60
61 } // namespace vista_util
62
63 } // namespace omaha
64
OLDNEW
« no previous file with comments | « base/vistautil.cc ('k') | base/window_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698