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

Side by Side Diff: ceee/ie/common/ceee_util_unittest.cc

Issue 5254012: Always use persistent profile for CF+CEEE installs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to head, address Amit's nit Created 10 years 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 | « ceee/ie/common/ceee_util.cc ('k') | ceee/ie/common/common.gyp » ('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 (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Unit tests for the CEEE utilities.
6
7 #include "ceee/ie/common/ceee_util.h"
8
9 #include <ostream> // NOLINT
10 #include <winerror.h>
11
12 #include "base/logging.h"
13 #include "gmock/gmock.h"
14 #include "gtest/gtest.h"
15 #include "ceee/testing/utils/mock_static.h"
16
17 namespace {
18
19 using testing::_;
20 using testing::Return;
21
22 TEST(CeeeUtilTest, IsIeCeeeRegisteredRealRegistry) {
23 // This exercises the code but does not assert on the result,
24 // it simply prints the result for human evaluation.
25 //
26 // It's hard to mock the HKCR registry so don't try for now;
27 // further tests mock out the entire registry access.
28 bool is_registered = ceee_util::IsIeCeeeRegistered();
29 std::cout << "IsIeCeeeRegistered returned " << is_registered << std::endl;
30 }
31
32 MOCK_STATIC_CLASS_BEGIN(MockRegOpenKeyEx)
33 MOCK_STATIC_INIT_BEGIN(MockRegOpenKeyEx)
34 MOCK_STATIC_INIT(RegOpenKeyEx);
35 MOCK_STATIC_INIT_END()
36
37 MOCK_STATIC5(LSTATUS, APIENTRY, RegOpenKeyEx,
38 HKEY, LPCWSTR, DWORD, REGSAM, PHKEY);
39 MOCK_STATIC_CLASS_END(MockRegOpenKeyEx)
40
41 TEST(CeeeUtilTest, IsIeCeeeRegisteredYes) {
42 MockRegOpenKeyEx mock_reg;
43 EXPECT_CALL(mock_reg, RegOpenKeyEx(_, _, _, _, _))
44 .WillOnce(Return(ERROR_SUCCESS));
45 ASSERT_TRUE(ceee_util::IsIeCeeeRegistered());
46 }
47
48 TEST(CeeeUtilTest, IsIeCeeeRegisteredNo) {
49 MockRegOpenKeyEx mock_reg;
50 EXPECT_CALL(mock_reg, RegOpenKeyEx(_, _, _, _, _))
51 .WillOnce(Return(ERROR_FILE_NOT_FOUND));
52 ASSERT_FALSE(ceee_util::IsIeCeeeRegistered());
53 }
54
55 } // namespace
OLDNEW
« no previous file with comments | « ceee/ie/common/ceee_util.cc ('k') | ceee/ie/common/common.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698