summaryrefslogtreecommitdiffstats
path: root/ceee/ie
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-01 19:58:30 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-01 19:58:30 +0000
commit38f57abb36fa6c91d9939a2393f9998dd40c51ba (patch)
tree061d6b93b361cd12589bb8fb294e831b6a66382b /ceee/ie
parentcb4da7b7cca16b19401ae9475383c70ac310337e (diff)
downloadchromium_src-38f57abb36fa6c91d9939a2393f9998dd40c51ba.zip
chromium_src-38f57abb36fa6c91d9939a2393f9998dd40c51ba.tar.gz
chromium_src-38f57abb36fa6c91d9939a2393f9998dd40c51ba.tar.bz2
Always use persistent profile for CF+CEEE installs.
BUG=64840 TEST=With --enable-ceee, CF profiles on IE7 should not be under Temporary Internet Files. Review URL: http://codereview.chromium.org/5254012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ceee/ie')
-rw-r--r--ceee/ie/common/ceee_util.cc29
-rw-r--r--ceee/ie/common/ceee_util.h17
-rw-r--r--ceee/ie/common/ceee_util_unittest.cc55
-rw-r--r--ceee/ie/common/common.gyp16
-rw-r--r--ceee/ie/ie.gyp1
5 files changed, 111 insertions, 7 deletions
diff --git a/ceee/ie/common/ceee_util.cc b/ceee/ie/common/ceee_util.cc
new file mode 100644
index 0000000..4d9b3d5
--- /dev/null
+++ b/ceee/ie/common/ceee_util.cc
@@ -0,0 +1,29 @@
+// 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.
+//
+// Utility functions for CEEE.
+
+#include "ceee/ie/common/ceee_util.h"
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "base/win/registry.h"
+
+#include "toolband.h" // NOLINT
+
+namespace ceee_util {
+
+bool IsIeCeeeRegistered() {
+ wchar_t clsid[40] = { 0 };
+ int num_chars = ::StringFromGUID2(CLSID_ToolBand, clsid, arraysize(clsid));
+ CHECK(num_chars > 0);
+
+ std::wstring path(L"CLSID\\");
+ path += clsid;
+
+ base::win::RegKey key;
+ return key.Open(HKEY_CLASSES_ROOT, path.c_str(), KEY_QUERY_VALUE);
+}
+
+} // namespace ceee_util
diff --git a/ceee/ie/common/ceee_util.h b/ceee/ie/common/ceee_util.h
new file mode 100644
index 0000000..36654fa
--- /dev/null
+++ b/ceee/ie/common/ceee_util.h
@@ -0,0 +1,17 @@
+// 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.
+//
+// Utility functions for CEEE.
+
+#ifndef CEEE_IE_COMMON_CEEE_UTIL_H_
+#define CEEE_IE_COMMON_CEEE_UTIL_H_
+
+namespace ceee_util {
+
+// Returns true iff the IE CEEE is registered.
+bool IsIeCeeeRegistered();
+
+} // namespace ceee_util
+
+#endif // CEEE_IE_COMMON_CEEE_UTIL_H_
diff --git a/ceee/ie/common/ceee_util_unittest.cc b/ceee/ie/common/ceee_util_unittest.cc
new file mode 100644
index 0000000..2414998
--- /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
diff --git a/ceee/ie/common/common.gyp b/ceee/ie/common/common.gyp
index 9a47400..8ef29dd 100644
--- a/ceee/ie/common/common.gyp
+++ b/ceee/ie/common/common.gyp
@@ -49,18 +49,20 @@
'type': 'static_library',
'dependencies': [
'ie_common_settings',
- '../../../base/base.gyp:base',
- '../../../breakpad/breakpad.gyp:breakpad_handler',
- '../../../build/temp_gyp/googleurl.gyp:googleurl',
- '../../../net/net.gyp:net_base',
- '../../../ceee/common/common.gyp:initializing_coclass',
- '../../../ceee/common/common.gyp:ceee_common',
+ '<(DEPTH)/base/base.gyp:base',
+ '<(DEPTH)/breakpad/breakpad.gyp:breakpad_handler',
+ '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl',
+ '<(DEPTH)/ceee/common/common.gyp:initializing_coclass',
+ '<(DEPTH)/ceee/common/common.gyp:ceee_common',
+ '<(DEPTH)/ceee/ie/plugin/toolband/toolband.gyp:toolband_idl',
'<(DEPTH)/chrome/chrome.gyp:chrome_version_header',
'<(DEPTH)/chrome_frame/chrome_frame.gyp:chrome_tab_idl',
- '../plugin/toolband/toolband.gyp:toolband_idl',
+ '<(DEPTH)/net/net.gyp:net_base',
],
'sources': [
'api_registration.h',
+ 'ceee_util.cc',
+ 'ceee_util.h',
'chrome_frame_host.cc',
'chrome_frame_host.h',
'constants.cc',
diff --git a/ceee/ie/ie.gyp b/ceee/ie/ie.gyp
index b3bd6a98..2ee286c 100644
--- a/ceee/ie/ie.gyp
+++ b/ceee/ie/ie.gyp
@@ -48,6 +48,7 @@
'broker/window_api_module_unittest.cc',
'broker/window_events_funnel_unittest.cc',
'common/ceee_module_util_unittest.cc',
+ 'common/ceee_util_unittest.cc',
'common/chrome_frame_host_unittest.cc',
'common/crash_reporter_unittest.cc',
'common/extension_manifest_unittest.cc',