summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/google_update_settings_unittest.cc
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 21:21:18 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 21:21:18 +0000
commit5ac8aff8fd32ece193f0eb12f89a90599186ea13 (patch)
treec25cb22ccb09cea9ba22cc238a9916f5658186ce /chrome/installer/util/google_update_settings_unittest.cc
parent6eac57a601d0f2e88390609b5716c08eb5f19b73 (diff)
downloadchromium_src-5ac8aff8fd32ece193f0eb12f89a90599186ea13.zip
chromium_src-5ac8aff8fd32ece193f0eb12f89a90599186ea13.tar.gz
chromium_src-5ac8aff8fd32ece193f0eb12f89a90599186ea13.tar.bz2
Handle eulaaccepted and oeminstall mo betta for multi-install. During first install, these values (deposited by Google Update) are now mirrored from the product-specific ClientState key into the binaries' key. When the EULA is accepted, the modification is written to both the product's and binaries' ClientStateMedium key. As a result, multi-install OEM installs will start updating only when the EULA is accepted (as desired) and the EVENT_INSTALL_OEM_FIRST_CHECK ping is sent for both the product and the binaries.
BUG=88584 TEST=see bug R=robertshield@chromium.org Review URL: http://codereview.chromium.org/7346011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92234 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/google_update_settings_unittest.cc')
-rw-r--r--chrome/installer/util/google_update_settings_unittest.cc54
1 files changed, 17 insertions, 37 deletions
diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc
index e27309d..aed09d5 100644
--- a/chrome/installer/util/google_update_settings_unittest.cc
+++ b/chrome/installer/util/google_update_settings_unittest.cc
@@ -5,20 +5,14 @@
#include <windows.h>
#include <shlwapi.h> // For SHDeleteKey.
-#include <functional>
-#include <map>
-
-#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/win/registry.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/channel_info.h"
+#include "chrome/installer/util/fake_installation_state.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/google_update_settings.h"
-#include "chrome/installer/util/installation_state.h"
-#include "chrome/installer/util/installer_state.h"
-#include "chrome/installer/util/master_preferences.h"
-#include "chrome/installer/util/product.h"
#include "chrome/installer/util/work_item_list.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -427,50 +421,36 @@ TEST_F(GoogleUpdateSettingsTest, UpdateInstallStatusTest) {
}
TEST_F(GoogleUpdateSettingsTest, SetEULAConsent) {
+ using installer::FakeInstallationState;
+
const bool multi_install = true;
const bool system_level = true;
- CommandLine cmd_line = CommandLine::FromString(
- std::wstring(L"setup.exe") +
- (multi_install ? L" --multi-install --chrome" : L"") +
- (system_level ? L" --system-level" : L""));
- installer::MasterPreferences prefs(cmd_line);
- installer::InstallationState machine_state;
- machine_state.Initialize();
- installer::InstallerState installer_state;
- installer_state.Initialize(cmd_line, prefs, machine_state);
- HKEY root = installer_state.root_key();
+ FakeInstallationState machine_state;
+
+ // Chrome is installed.
+ machine_state.AddChrome(system_level, multi_install,
+ Version::GetVersionFromString(chrome::kChromeVersion));
RegKey key;
DWORD value;
BrowserDistribution* binaries =
- installer_state.multi_package_binaries_distribution();
- EXPECT_EQ(BrowserDistribution::CHROME_BINARIES, binaries->GetType());
+ BrowserDistribution::GetSpecificDistribution(
+ BrowserDistribution::CHROME_BINARIES);
BrowserDistribution* chrome =
- installer_state.products()[0]->distribution();
- EXPECT_EQ(BrowserDistribution::CHROME_BROWSER, chrome->GetType());
+ BrowserDistribution::GetSpecificDistribution(
+ BrowserDistribution::CHROME_BROWSER);
- // By default, eulaconsent ends up on the package.
- EXPECT_TRUE(GoogleUpdateSettings::SetEULAConsent(installer_state, true));
+ // eulaconsent is set on both the product and the binaries.
+ EXPECT_TRUE(GoogleUpdateSettings::SetEULAConsent(machine_state, true));
EXPECT_EQ(ERROR_SUCCESS,
key.Open(HKEY_LOCAL_MACHINE, binaries->GetStateMediumKey().c_str(),
- KEY_QUERY_VALUE | KEY_SET_VALUE));
+ KEY_QUERY_VALUE));
EXPECT_EQ(ERROR_SUCCESS,
key.ReadValueDW(google_update::kRegEULAAceptedField, &value));
EXPECT_EQ(1U, value);
EXPECT_EQ(ERROR_SUCCESS,
- key.DeleteValue(google_update::kRegEULAAceptedField));
-
- // But it will end up on the product if needed
- EXPECT_EQ(ERROR_SUCCESS,
- key.Create(HKEY_LOCAL_MACHINE, chrome->GetStateKey().c_str(),
- KEY_SET_VALUE));
- EXPECT_EQ(ERROR_SUCCESS,
- key.WriteValue(google_update::kRegEULAAceptedField,
- static_cast<DWORD>(0)));
- EXPECT_TRUE(GoogleUpdateSettings::SetEULAConsent(installer_state, true));
- EXPECT_EQ(ERROR_SUCCESS,
key.Open(HKEY_LOCAL_MACHINE, chrome->GetStateMediumKey().c_str(),
- KEY_QUERY_VALUE | KEY_SET_VALUE));
+ KEY_QUERY_VALUE));
EXPECT_EQ(ERROR_SUCCESS,
key.ReadValueDW(google_update::kRegEULAAceptedField, &value));
EXPECT_EQ(1U, value);