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

Side by Side Diff: chrome/installer/util/google_update_settings_unittest.cc

Issue 282363003: Add WOW64 support to the installer registry work items (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: nits. fix call to DeleteRegistryKey Created 6 years, 7 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <windows.h> 5 #include <windows.h>
6 #include <shlwapi.h> // For SHDeleteKey. 6 #include <shlwapi.h> // For SHDeleteKey.
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/test_reg_util_win.h" 10 #include "base/test/test_reg_util_win.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 EXPECT_FALSE(GoogleUpdateSettings::ReadExperimentLabels( 156 EXPECT_FALSE(GoogleUpdateSettings::ReadExperimentLabels(
157 install == SYSTEM_INSTALL, &value)); 157 install == SYSTEM_INSTALL, &value));
158 #endif // GOOGLE_CHROME_BUILD 158 #endif // GOOGLE_CHROME_BUILD
159 } 159 }
160 160
161 // Creates "ap" key with the value given as parameter. Also adds work 161 // Creates "ap" key with the value given as parameter. Also adds work
162 // items to work_item_list given so that they can be rolled back later. 162 // items to work_item_list given so that they can be rolled back later.
163 bool CreateApKey(WorkItemList* work_item_list, const std::wstring& value) { 163 bool CreateApKey(WorkItemList* work_item_list, const std::wstring& value) {
164 HKEY reg_root = HKEY_CURRENT_USER; 164 HKEY reg_root = HKEY_CURRENT_USER;
165 std::wstring reg_key = GetApKeyPath(); 165 std::wstring reg_key = GetApKeyPath();
166 work_item_list->AddCreateRegKeyWorkItem(reg_root, reg_key); 166 work_item_list->AddCreateRegKeyWorkItem(
167 work_item_list->AddSetRegValueWorkItem(reg_root, reg_key, 167 reg_root, reg_key, WorkItem::kWow64Default);
168 google_update::kRegApField, value.c_str(), true); 168 work_item_list->AddSetRegValueWorkItem(reg_root,
169 reg_key,
170 WorkItem::kWow64Default,
171 google_update::kRegApField,
172 value.c_str(),
173 true);
169 if (!work_item_list->Do()) { 174 if (!work_item_list->Do()) {
170 work_item_list->Rollback(); 175 work_item_list->Rollback();
171 return false; 176 return false;
172 } 177 }
173 return true; 178 return true;
174 } 179 }
175 180
176 // Returns the key path of "ap" key, e.g.: 181 // Returns the key path of "ap" key, e.g.:
177 // Google\Update\ClientState\<kTestProductGuid> 182 // Google\Update\ClientState\<kTestProductGuid>
178 std::wstring GetApKeyPath() { 183 std::wstring GetApKeyPath() {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 465
461 work_item_list.reset(WorkItem::CreateWorkItemList()); 466 work_item_list.reset(WorkItem::CreateWorkItemList());
462 // Test the case of when "ap" key doesnt exist at all 467 // Test the case of when "ap" key doesnt exist at all
463 std::wstring ap_key_value = ReadApKeyValue(); 468 std::wstring ap_key_value = ReadApKeyValue();
464 std::wstring reg_key = GetApKeyPath(); 469 std::wstring reg_key = GetApKeyPath();
465 HKEY reg_root = HKEY_CURRENT_USER; 470 HKEY reg_root = HKEY_CURRENT_USER;
466 bool ap_key_deleted = false; 471 bool ap_key_deleted = false;
467 RegKey key; 472 RegKey key;
468 if (key.Open(HKEY_CURRENT_USER, reg_key.c_str(), KEY_ALL_ACCESS) != 473 if (key.Open(HKEY_CURRENT_USER, reg_key.c_str(), KEY_ALL_ACCESS) !=
469 ERROR_SUCCESS) { 474 ERROR_SUCCESS) {
470 work_item_list->AddCreateRegKeyWorkItem(reg_root, reg_key); 475 work_item_list->AddCreateRegKeyWorkItem(
476 reg_root, reg_key, WorkItem::kWow64Default);
471 ASSERT_TRUE(work_item_list->Do()) << "Failed to create ClientState key."; 477 ASSERT_TRUE(work_item_list->Do()) << "Failed to create ClientState key.";
472 } else if (key.DeleteValue(google_update::kRegApField) == ERROR_SUCCESS) { 478 } else if (key.DeleteValue(google_update::kRegApField) == ERROR_SUCCESS) {
473 ap_key_deleted = true; 479 ap_key_deleted = true;
474 } 480 }
475 // try differential installer 481 // try differential installer
476 GoogleUpdateSettings::UpdateInstallStatus(false, 482 GoogleUpdateSettings::UpdateInstallStatus(false,
477 installer::INCREMENTAL_ARCHIVE_TYPE, 483 installer::INCREMENTAL_ARCHIVE_TYPE,
478 installer::INSTALL_FAILED, 484 installer::INSTALL_FAILED,
479 kTestProductGuid); 485 kTestProductGuid);
480 EXPECT_STREQ(ReadApKeyValue().c_str(), L"-full"); 486 EXPECT_STREQ(ReadApKeyValue().c_str(), L"-full");
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, 1169 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL,
1164 StatsState::FALSE_SETTING, StatsState::FALSE_SETTING), 1170 StatsState::FALSE_SETTING, StatsState::FALSE_SETTING),
1165 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, 1171 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL,
1166 StatsState::FALSE_SETTING, StatsState::TRUE_SETTING), 1172 StatsState::FALSE_SETTING, StatsState::TRUE_SETTING),
1167 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, 1173 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL,
1168 StatsState::TRUE_SETTING, StatsState::NO_SETTING), 1174 StatsState::TRUE_SETTING, StatsState::NO_SETTING),
1169 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, 1175 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL,
1170 StatsState::TRUE_SETTING, StatsState::FALSE_SETTING), 1176 StatsState::TRUE_SETTING, StatsState::FALSE_SETTING),
1171 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, 1177 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL,
1172 StatsState::TRUE_SETTING, StatsState::TRUE_SETTING))); 1178 StatsState::TRUE_SETTING, StatsState::TRUE_SETTING)));
OLDNEW
« no previous file with comments | « chrome/installer/util/delete_reg_value_work_item_unittest.cc ('k') | chrome/installer/util/install_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698