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

Unified 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, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ceee/ie/common/ceee_util.cc ('k') | ceee/ie/common/common.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ceee/ie/common/ceee_util_unittest.cc
diff --git a/ceee/ie/common/ceee_util_unittest.cc b/ceee/ie/common/ceee_util_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..24149989fe058b1a376f1abf232b79610813e461
--- /dev/null
+++ b/ceee/ie/common/ceee_util_unittest.cc
@@ -0,0 +1,55 @@
+// 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.
+//
+// Unit tests for the CEEE utilities.
+
+#include "ceee/ie/common/ceee_util.h"
+
+#include <ostream> // NOLINT
+#include <winerror.h>
+
+#include "base/logging.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "ceee/testing/utils/mock_static.h"
+
+namespace {
+
+using testing::_;
+using testing::Return;
+
+TEST(CeeeUtilTest, IsIeCeeeRegisteredRealRegistry) {
+ // This exercises the code but does not assert on the result,
+ // it simply prints the result for human evaluation.
+ //
+ // It's hard to mock the HKCR registry so don't try for now;
+ // further tests mock out the entire registry access.
+ bool is_registered = ceee_util::IsIeCeeeRegistered();
+ std::cout << "IsIeCeeeRegistered returned " << is_registered << std::endl;
+}
+
+MOCK_STATIC_CLASS_BEGIN(MockRegOpenKeyEx)
+ MOCK_STATIC_INIT_BEGIN(MockRegOpenKeyEx)
+ MOCK_STATIC_INIT(RegOpenKeyEx);
+ MOCK_STATIC_INIT_END()
+
+ MOCK_STATIC5(LSTATUS, APIENTRY, RegOpenKeyEx,
+ HKEY, LPCWSTR, DWORD, REGSAM, PHKEY);
+MOCK_STATIC_CLASS_END(MockRegOpenKeyEx)
+
+TEST(CeeeUtilTest, IsIeCeeeRegisteredYes) {
+ MockRegOpenKeyEx mock_reg;
+ EXPECT_CALL(mock_reg, RegOpenKeyEx(_, _, _, _, _))
+ .WillOnce(Return(ERROR_SUCCESS));
+ ASSERT_TRUE(ceee_util::IsIeCeeeRegistered());
+}
+
+TEST(CeeeUtilTest, IsIeCeeeRegisteredNo) {
+ MockRegOpenKeyEx mock_reg;
+ EXPECT_CALL(mock_reg, RegOpenKeyEx(_, _, _, _, _))
+ .WillOnce(Return(ERROR_FILE_NOT_FOUND));
+ ASSERT_FALSE(ceee_util::IsIeCeeeRegistered());
+}
+
+} // namespace
« 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