From 7bc272f38646abb81b58c89a59d8e6842f9e9631 Mon Sep 17 00:00:00 2001
From: "ananta@chromium.org"
 <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 9 Dec 2009 01:09:28 +0000
Subject: Added support for running reliability tests for ChromeFrame on
 similar lines as Chrome. We only run these tests for IE at this point. The
 reliability test code for Chrome has been copied and modified accordingly.

Other related changes in this CL include the following:-
1. If ChromeFrame is running in headless mode determined by a registry value in HKCU\Software\Google\ChromeFrame
   we initialize ChromeFrame crash reporting and connect to the Chrome crash server. This would enable us to
   gather crash dumps from the reliability test runs and report the same.

2. The LowIntegrity fixes for the WebBrowser which Stoyan had done a while back are only needed for IE7 on Vista.
   For this CL though we just do the requisite hacks if the OS is Vista. For Windows7 the returned IWebBrowser
   interface pointer works fine.

3. I moved the WebBrowserEventSink to chrome_frame_test_utils as this class is now shared.

Fixes portions of http://code.google.com/p/chromium/issues/detail?id=29451

Bug=29451

Review URL: http://codereview.chromium.org/465074

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34119 0039d316-1c4b-4281-b951-d872f2087c98
---
 chrome_frame/utils.cc | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

(limited to 'chrome_frame/utils.cc')

diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index 1edbee9..b97e461 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -47,6 +47,10 @@ const wchar_t kDevChannelName[] = L"-dev";
 
 const wchar_t kChromeAttachExternalTabPrefix[] = L"attach_external_tab";
 
+// Indicates that we are running in a test environment, where execptions, etc
+// are handled by the chrome test crash server.
+const wchar_t kChromeFrameHeadlessMode[] = L"ChromeFrameHeadlessMode";
+
 HRESULT UtilRegisterTypeLib(HINSTANCE tlb_instance,
                             LPCOLESTR index,
                             bool for_current_user_only) {
@@ -546,6 +550,31 @@ bool GetConfigBool(bool default_value, const wchar_t* value_name) {
   return (value != FALSE);
 }
 
+bool SetConfigInt(const wchar_t* value_name, int value) {
+  RegKey config_key;
+  if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey,
+                      KEY_SET_VALUE)) {
+    if (config_key.WriteValue(value_name, value)) {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool SetConfigBool(const wchar_t* value_name, bool value) {
+  return SetConfigInt(value_name, value);
+}
+
+bool DeleteConfigValue(const wchar_t* value_name) {
+  RegKey config_key;
+  if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey,
+                      KEY_WRITE)) {
+    return config_key.DeleteValue(value_name);
+  }
+  return false;
+}
+
 bool IsOptInUrl(const wchar_t* url) {
   RegKey config_key;
   if (!config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, KEY_READ))
@@ -667,3 +696,9 @@ bool IsSubFrameRequest(IUnknown* service_provider) {
 
   return is_non_top_level_request;
 }
+
+bool IsHeadlessMode() {
+  bool headless = GetConfigBool(false, kChromeFrameHeadlessMode);
+  return headless;
+}
+
-- 
cgit v1.1