| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/installer/setup/install_worker.h" | 5 #include "chrome/installer/setup/install_worker.h" |
| 6 | 6 |
| 7 #include "base/win/registry.h" | 7 #include "base/win/registry.h" |
| 8 #include "base/version.h" | 8 #include "base/version.h" |
| 9 #include "chrome/common/chrome_constants.h" | 9 #include "chrome/common/chrome_constants.h" |
| 10 #include "chrome/installer/util/delete_reg_key_work_item.h" | 10 #include "chrome/installer/util/delete_reg_key_work_item.h" |
| 11 #include "chrome/installer/util/create_reg_key_work_item.h" | 11 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 12 #include "chrome/installer/util/helper.h" | 12 #include "chrome/installer/util/helper.h" |
| 13 #include "chrome/installer/util/google_update_constants.h" | 13 #include "chrome/installer/util/google_update_constants.h" |
| 14 #include "chrome/installer/util/installation_state.h" | 14 #include "chrome/installer/util/installation_state.h" |
| 15 #include "chrome/installer/util/installer_state.h" | 15 #include "chrome/installer/util/installer_state.h" |
| 16 #include "chrome/installer/util/set_reg_value_work_item.h" | 16 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 17 #include "chrome/installer/util/util_constants.h" | 17 #include "chrome/installer/util/util_constants.h" |
| 18 #include "chrome/installer/util/work_item_list.h" | 18 #include "chrome/installer/util/work_item_list.h" |
| 19 | 19 |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 | 22 |
| 23 using base::win::RegKey; |
| 23 using installer::InstallationState; | 24 using installer::InstallationState; |
| 24 using installer::InstallerState; | 25 using installer::InstallerState; |
| 25 using installer::Product; | 26 using installer::Product; |
| 26 using installer::ProductState; | 27 using installer::ProductState; |
| 27 | 28 |
| 28 using ::testing::_; | 29 using ::testing::_; |
| 29 using ::testing::AtLeast; | 30 using ::testing::AtLeast; |
| 31 using ::testing::AtMost; |
| 32 using ::testing::Bool; |
| 33 using ::testing::Combine; |
| 30 using ::testing::HasSubstr; | 34 using ::testing::HasSubstr; |
| 31 using ::testing::AtMost; | |
| 32 using ::testing::Eq; | 35 using ::testing::Eq; |
| 33 using ::testing::Return; | 36 using ::testing::Return; |
| 34 using ::testing::StrCaseEq; | 37 using ::testing::StrCaseEq; |
| 35 using ::testing::StrEq; | 38 using ::testing::StrEq; |
| 36 using ::testing::StrictMock; | 39 using ::testing::StrictMock; |
| 40 using ::testing::Values; |
| 37 | 41 |
| 38 // Mock classes to help with testing | 42 // Mock classes to help with testing |
| 39 //------------------------------------------------------------------------------ | 43 //------------------------------------------------------------------------------ |
| 40 | 44 |
| 41 class MockWorkItemList : public WorkItemList { | 45 class MockWorkItemList : public WorkItemList { |
| 42 public: | 46 public: |
| 43 MockWorkItemList() {} | 47 MockWorkItemList() {} |
| 44 | 48 |
| 49 MOCK_METHOD4(AddCopyRegKeyWorkItem, WorkItem* (HKEY, |
| 50 const std::wstring&, |
| 51 const std::wstring&, |
| 52 CopyOverWriteOption)); |
| 45 MOCK_METHOD5(AddCopyTreeWorkItem, WorkItem*(const std::wstring&, | 53 MOCK_METHOD5(AddCopyTreeWorkItem, WorkItem*(const std::wstring&, |
| 46 const std::wstring&, | 54 const std::wstring&, |
| 47 const std::wstring&, | 55 const std::wstring&, |
| 48 CopyOverWriteOption, | 56 CopyOverWriteOption, |
| 49 const std::wstring&)); | 57 const std::wstring&)); |
| 50 MOCK_METHOD1(AddCreateDirWorkItem, WorkItem* (const FilePath&)); | 58 MOCK_METHOD1(AddCreateDirWorkItem, WorkItem* (const FilePath&)); |
| 51 MOCK_METHOD2(AddCreateRegKeyWorkItem, WorkItem* (HKEY, const std::wstring&)); | 59 MOCK_METHOD2(AddCreateRegKeyWorkItem, WorkItem* (HKEY, const std::wstring&)); |
| 52 MOCK_METHOD2(AddDeleteRegKeyWorkItem, WorkItem* (HKEY, const std::wstring&)); | 60 MOCK_METHOD2(AddDeleteRegKeyWorkItem, WorkItem* (HKEY, const std::wstring&)); |
| 53 MOCK_METHOD3(AddDeleteRegValueWorkItem, WorkItem* (HKEY, | 61 MOCK_METHOD3(AddDeleteRegValueWorkItem, WorkItem* (HKEY, |
| 54 const std::wstring&, | 62 const std::wstring&, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 installation_path_ = FilePath(L"C:\\Program Files\\Google\\Chrome\\"); | 177 installation_path_ = FilePath(L"C:\\Program Files\\Google\\Chrome\\"); |
| 170 src_path_ = | 178 src_path_ = |
| 171 FilePath(L"C:\\UnlikelyPath\\Temp\\chrome_123\\source\\Chrome-bin"); | 179 FilePath(L"C:\\UnlikelyPath\\Temp\\chrome_123\\source\\Chrome-bin"); |
| 172 setup_path_ = FilePath(L"C:\\UnlikelyPath\\Temp\\CR_123.tmp\\setup.exe"); | 180 setup_path_ = FilePath(L"C:\\UnlikelyPath\\Temp\\CR_123.tmp\\setup.exe"); |
| 173 temp_dir_ = FilePath(L"C:\\UnlikelyPath\\Temp\\chrome_123"); | 181 temp_dir_ = FilePath(L"C:\\UnlikelyPath\\Temp\\chrome_123"); |
| 174 } | 182 } |
| 175 | 183 |
| 176 virtual void TearDown() { | 184 virtual void TearDown() { |
| 177 } | 185 } |
| 178 | 186 |
| 187 void MaybeAddBinariesToInstallationState( |
| 188 bool system_level, |
| 189 MockInstallationState* installation_state) { |
| 190 if (installation_state->GetProductState( |
| 191 system_level, BrowserDistribution::CHROME_BINARIES) == NULL) { |
| 192 MockProductState product_state; |
| 193 product_state.set_version(current_version_->Clone()); |
| 194 installation_state->SetProductState(system_level, |
| 195 BrowserDistribution::CHROME_BINARIES, |
| 196 product_state); |
| 197 } |
| 198 } |
| 199 |
| 179 void AddChromeToInstallationState( | 200 void AddChromeToInstallationState( |
| 180 bool system_level, | 201 bool system_level, |
| 181 bool multi_install, | 202 bool multi_install, |
| 182 bool with_chrome_frame_ready_mode, | 203 bool with_chrome_frame_ready_mode, |
| 183 MockInstallationState* installation_state) { | 204 MockInstallationState* installation_state) { |
| 205 if (multi_install) |
| 206 MaybeAddBinariesToInstallationState(system_level, installation_state); |
| 184 MockProductState product_state; | 207 MockProductState product_state; |
| 185 product_state.set_version(current_version_->Clone()); | 208 product_state.set_version(current_version_->Clone()); |
| 186 product_state.set_multi_install(multi_install); | 209 product_state.set_multi_install(multi_install); |
| 187 product_state.set_brand(L"TEST"); | 210 product_state.set_brand(L"TEST"); |
| 188 product_state.set_eula_accepted(1); | 211 product_state.set_eula_accepted(1); |
| 189 BrowserDistribution* dist = | 212 BrowserDistribution* dist = |
| 190 BrowserDistribution::GetSpecificDistribution( | 213 BrowserDistribution::GetSpecificDistribution( |
| 191 BrowserDistribution::CHROME_BROWSER); | 214 BrowserDistribution::CHROME_BROWSER); |
| 192 FilePath install_path = | 215 FilePath install_path = |
| 193 installer::GetChromeInstallPath(system_level, dist); | 216 installer::GetChromeInstallPath(system_level, dist); |
| 194 product_state.SetUninstallProgram( | 217 product_state.SetUninstallProgram( |
| 195 install_path.Append(installer::kSetupExe)); | 218 install_path.AppendASCII(current_version_->GetString()) |
| 219 .Append(installer::kInstallerDir) |
| 220 .Append(installer::kSetupExe)); |
| 196 product_state.AddUninstallSwitch(installer::switches::kUninstall); | 221 product_state.AddUninstallSwitch(installer::switches::kUninstall); |
| 197 if (system_level) | 222 if (system_level) |
| 198 product_state.AddUninstallSwitch(installer::switches::kSystemLevel); | 223 product_state.AddUninstallSwitch(installer::switches::kSystemLevel); |
| 199 if (multi_install) { | 224 if (multi_install) { |
| 200 product_state.AddUninstallSwitch(installer::switches::kMultiInstall); | 225 product_state.AddUninstallSwitch(installer::switches::kMultiInstall); |
| 201 product_state.AddUninstallSwitch(installer::switches::kChrome); | 226 product_state.AddUninstallSwitch(installer::switches::kChrome); |
| 202 if (with_chrome_frame_ready_mode) { | 227 if (with_chrome_frame_ready_mode) { |
| 203 product_state.AddUninstallSwitch(installer::switches::kChromeFrame); | 228 product_state.AddUninstallSwitch(installer::switches::kChromeFrame); |
| 204 product_state.AddUninstallSwitch( | 229 product_state.AddUninstallSwitch( |
| 205 installer::switches::kChromeFrameReadyMode); | 230 installer::switches::kChromeFrameReadyMode); |
| 206 } | 231 } |
| 207 } | 232 } |
| 208 | 233 |
| 209 installation_state->SetProductState(system_level, | 234 installation_state->SetProductState(system_level, |
| 210 BrowserDistribution::CHROME_BROWSER, | 235 BrowserDistribution::CHROME_BROWSER, |
| 211 product_state); | 236 product_state); |
| 212 } | 237 } |
| 213 | 238 |
| 214 void AddChromeFrameToInstallationState( | 239 void AddChromeFrameToInstallationState( |
| 215 bool system_level, | 240 bool system_level, |
| 216 bool multi_install, | 241 bool multi_install, |
| 217 bool ready_mode, | 242 bool ready_mode, |
| 218 MockInstallationState* installation_state) { | 243 MockInstallationState* installation_state) { |
| 244 if (multi_install) |
| 245 MaybeAddBinariesToInstallationState(system_level, installation_state); |
| 219 MockProductState product_state; | 246 MockProductState product_state; |
| 220 product_state.set_version(current_version_->Clone()); | 247 product_state.set_version(current_version_->Clone()); |
| 221 product_state.set_multi_install(multi_install); | 248 product_state.set_multi_install(multi_install); |
| 222 BrowserDistribution* dist = | 249 BrowserDistribution* dist = |
| 223 BrowserDistribution::GetSpecificDistribution( | 250 BrowserDistribution::GetSpecificDistribution( |
| 224 multi_install ? BrowserDistribution::CHROME_BINARIES : | 251 multi_install ? BrowserDistribution::CHROME_BINARIES : |
| 225 BrowserDistribution::CHROME_FRAME); | 252 BrowserDistribution::CHROME_FRAME); |
| 226 FilePath install_path = | 253 FilePath install_path = |
| 227 installer::GetChromeInstallPath(system_level, dist); | 254 installer::GetChromeInstallPath(system_level, dist); |
| 228 product_state.SetUninstallProgram( | 255 product_state.SetUninstallProgram( |
| 229 install_path.Append(installer::kSetupExe)); | 256 install_path.AppendASCII(current_version_->GetString()) |
| 257 .Append(installer::kInstallerDir) |
| 258 .Append(installer::kSetupExe)); |
| 230 product_state.AddUninstallSwitch(installer::switches::kUninstall); | 259 product_state.AddUninstallSwitch(installer::switches::kUninstall); |
| 231 product_state.AddUninstallSwitch(installer::switches::kChromeFrame); | 260 product_state.AddUninstallSwitch(installer::switches::kChromeFrame); |
| 232 if (system_level) | 261 if (system_level) |
| 233 product_state.AddUninstallSwitch(installer::switches::kSystemLevel); | 262 product_state.AddUninstallSwitch(installer::switches::kSystemLevel); |
| 234 if (multi_install) { | 263 if (multi_install) { |
| 235 product_state.AddUninstallSwitch(installer::switches::kMultiInstall); | 264 product_state.AddUninstallSwitch(installer::switches::kMultiInstall); |
| 236 if (ready_mode) { | 265 if (ready_mode) { |
| 237 product_state.AddUninstallSwitch( | 266 product_state.AddUninstallSwitch( |
| 238 installer::switches::kChromeFrameReadyMode); | 267 installer::switches::kChromeFrameReadyMode); |
| 239 } | 268 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 *new_version_.get(), | 415 *new_version_.get(), |
| 387 ¤t_version_, | 416 ¤t_version_, |
| 388 &work_item_list); | 417 &work_item_list); |
| 389 } | 418 } |
| 390 | 419 |
| 391 namespace { | 420 namespace { |
| 392 | 421 |
| 393 const wchar_t elevation_key[] = | 422 const wchar_t elevation_key[] = |
| 394 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\" | 423 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\" |
| 395 L"{E0A900DF-9611-4446-86BD-4B1D47E7DB2A}"; | 424 L"{E0A900DF-9611-4446-86BD-4B1D47E7DB2A}"; |
| 396 const wchar_t dragdrop_key[] = | 425 const wchar_t old_elevation_key[] = |
| 397 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\DragDrop\\" | 426 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\" |
| 398 L"{E0A900DF-9611-4446-86BD-4B1D47E7DB2A}"; | 427 L"{6C288DD7-76FB-4721-B628-56FAC252E199}"; |
| 399 | 428 |
| 400 } // namespace | 429 } // namespace |
| 401 | 430 |
| 402 TEST_F(InstallWorkerTest, ElevationPolicyWorkItems) { | 431 // A test class for worker functions that manipulate the old IE low rights |
| 403 const bool system_level = true; | 432 // policies. |
| 404 const HKEY root = HKEY_LOCAL_MACHINE; | 433 // Parameters: |
| 405 const bool multi_install = true; | 434 // bool : system_level_ |
| 406 MockWorkItemList work_item_list; | 435 // bool : multi_install_ |
| 436 class OldIELowRightsTests : public InstallWorkerTest, |
| 437 public ::testing::WithParamInterface<std::tr1::tuple<bool, bool> > { |
| 438 protected: |
| 439 virtual void SetUp() OVERRIDE { |
| 440 InstallWorkerTest::SetUp(); |
| 407 | 441 |
| 408 scoped_ptr<MockInstallationState> installation_state( | 442 const ParamType& param = GetParam(); |
| 409 BuildChromeInstallationState(system_level, multi_install)); | 443 system_level_ = std::tr1::get<0>(param); |
| 444 multi_install_ = std::tr1::get<1>(param); |
| 445 root_key_ = system_level_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 410 | 446 |
| 411 scoped_ptr<MockInstallerState> installer_state( | 447 installation_state_.reset(new MockInstallationState()); |
| 412 BuildChromeInstallerState(system_level, multi_install, | 448 AddChromeFrameToInstallationState(system_level_, multi_install_, false, |
| 413 *installation_state, | 449 installation_state_.get()); |
| 414 InstallerState::MULTI_INSTALL)); | 450 installer_state_.reset(BuildBasicInstallerState( |
| 451 system_level_, multi_install_, *installation_state_, |
| 452 multi_install_ ? InstallerState::MULTI_UPDATE : |
| 453 InstallerState::SINGLE_INSTALL_OR_UPDATE)); |
| 454 AddChromeFrameToInstallerState(*installation_state_, false, |
| 455 installer_state_.get()); |
| 456 } |
| 415 | 457 |
| 416 EXPECT_CALL(work_item_list, AddCreateRegKeyWorkItem(root, | 458 scoped_ptr<MockInstallationState> installation_state_; |
| 417 StrEq(elevation_key))).Times(1); | 459 scoped_ptr<MockInstallerState> installer_state_; |
| 460 bool system_level_; |
| 461 bool multi_install_; |
| 462 HKEY root_key_; |
| 463 }; |
| 418 | 464 |
| 419 EXPECT_CALL(work_item_list, AddCreateRegKeyWorkItem(root, | 465 TEST_P(OldIELowRightsTests, AddDeleteOldIELowRightsPolicyWorkItems) { |
| 420 StrEq(dragdrop_key))).Times(1); | 466 StrictMock<MockWorkItemList> work_item_list; |
| 421 | 467 |
| 422 EXPECT_CALL(work_item_list, AddSetRegDwordValueWorkItem(root, | 468 EXPECT_CALL(work_item_list, |
| 423 StrEq(elevation_key), StrEq(L"Policy"), 3, _)).Times(1); | 469 AddDeleteRegKeyWorkItem(root_key_, StrEq(old_elevation_key))) |
| 470 .Times(1); |
| 424 | 471 |
| 425 EXPECT_CALL(work_item_list, AddSetRegStringValueWorkItem(root, | 472 AddDeleteOldIELowRightsPolicyWorkItems(*installer_state_.get(), |
| 426 StrEq(elevation_key), StrEq(L"AppName"), | 473 &work_item_list); |
| 427 StrEq(installer::kChromeLauncherExe), _)).Times(1); | |
| 428 | |
| 429 EXPECT_CALL(work_item_list, AddSetRegStringValueWorkItem(root, | |
| 430 StrEq(elevation_key), StrEq(L"AppPath"), _, _)).Times(1); | |
| 431 | |
| 432 EXPECT_CALL(work_item_list, AddSetRegDwordValueWorkItem(root, | |
| 433 StrEq(dragdrop_key), StrEq(L"Policy"), 3, _)).Times(1); | |
| 434 | |
| 435 EXPECT_CALL(work_item_list, AddSetRegStringValueWorkItem(root, | |
| 436 StrEq(dragdrop_key), StrEq(L"AppName"), | |
| 437 StrEq(chrome::kBrowserProcessExecutableName), _)).Times(1); | |
| 438 | |
| 439 EXPECT_CALL(work_item_list, AddSetRegStringValueWorkItem(root, | |
| 440 StrEq(dragdrop_key), StrEq(L"AppPath"), _, _)).Times(1); | |
| 441 | |
| 442 AddElevationPolicyWorkItems(*installation_state.get(), | |
| 443 *installer_state.get(), | |
| 444 *new_version_.get(), | |
| 445 &work_item_list); | |
| 446 } | 474 } |
| 447 | 475 |
| 448 TEST_F(InstallWorkerTest, ElevationPolicyUninstall) { | 476 TEST_P(OldIELowRightsTests, AddCopyIELowRightsPolicyWorkItems) { |
| 449 const bool system_level = true; | 477 StrictMock<MockWorkItemList> work_item_list; |
| 450 const HKEY root = HKEY_LOCAL_MACHINE; | |
| 451 const bool multi_install = true; | |
| 452 MockWorkItemList work_item_list; | |
| 453 | 478 |
| 454 scoped_ptr<MockInstallationState> installation_state( | 479 // The old elevation policy key should only be copied when there's no old |
| 455 BuildChromeInstallationState(system_level, multi_install)); | 480 // value. |
| 481 EXPECT_CALL(work_item_list, |
| 482 AddCopyRegKeyWorkItem(root_key_, StrEq(elevation_key), |
| 483 StrEq(old_elevation_key), |
| 484 Eq(WorkItem::IF_NOT_PRESENT))).Times(1); |
| 456 | 485 |
| 457 scoped_ptr<MockInstallerState> installer_state( | 486 AddCopyIELowRightsPolicyWorkItems(*installer_state_.get(), &work_item_list); |
| 458 BuildChromeInstallerState(system_level, multi_install, | |
| 459 *installation_state, | |
| 460 InstallerState::UNINSTALL)); | |
| 461 | |
| 462 EXPECT_CALL(work_item_list, AddDeleteRegKeyWorkItem(root, | |
| 463 StrEq(elevation_key))).Times(1); | |
| 464 EXPECT_CALL(work_item_list, AddDeleteRegKeyWorkItem(root, | |
| 465 StrEq(dragdrop_key))).Times(1); | |
| 466 | |
| 467 AddElevationPolicyWorkItems(*installation_state.get(), | |
| 468 *installer_state.get(), | |
| 469 *new_version_.get(), | |
| 470 &work_item_list); | |
| 471 } | 487 } |
| 472 | 488 |
| 473 TEST_F(InstallWorkerTest, ElevationPolicySingleNoop) { | 489 INSTANTIATE_TEST_CASE_P(Variations, OldIELowRightsTests, |
| 474 const bool system_level = true; | 490 Combine(Bool(), Bool())); |
| 475 const bool multi_install = false; // nothing should be done for single. | |
| 476 MockWorkItemList work_item_list; | |
| 477 | |
| 478 scoped_ptr<MockInstallationState> installation_state( | |
| 479 BuildChromeInstallationState(system_level, multi_install)); | |
| 480 | |
| 481 scoped_ptr<MockInstallerState> installer_state( | |
| 482 BuildChromeInstallerState(system_level, multi_install, | |
| 483 *installation_state, | |
| 484 InstallerState::UNINSTALL)); | |
| 485 | |
| 486 EXPECT_CALL(work_item_list, AddDeleteRegKeyWorkItem(_, _)).Times(0); | |
| 487 EXPECT_CALL(work_item_list, AddCreateRegKeyWorkItem(_, _)).Times(0); | |
| 488 EXPECT_CALL(work_item_list, AddSetRegDwordValueWorkItem(_, _, _, _, _)) | |
| 489 .Times(0); | |
| 490 EXPECT_CALL(work_item_list, AddSetRegStringValueWorkItem(_, _, _, _, _)) | |
| 491 .Times(0); | |
| 492 | |
| 493 AddElevationPolicyWorkItems(*installation_state.get(), | |
| 494 *installer_state.get(), | |
| 495 *new_version_.get(), | |
| 496 &work_item_list); | |
| 497 } | |
| 498 | |
| 499 TEST_F(InstallWorkerTest, ElevationPolicyExistingSingleCFNoop) { | |
| 500 const bool system_level = true; | |
| 501 const bool multi_install = true; | |
| 502 MockWorkItemList work_item_list; | |
| 503 | |
| 504 scoped_ptr<MockInstallationState> installation_state( | |
| 505 BuildChromeInstallationState(system_level, multi_install)); | |
| 506 | |
| 507 MockProductState cf_state; | |
| 508 cf_state.set_version(current_version_->Clone()); | |
| 509 cf_state.set_multi_install(false); | |
| 510 | |
| 511 installation_state->SetProductState(system_level, | |
| 512 BrowserDistribution::CHROME_FRAME, cf_state); | |
| 513 | |
| 514 scoped_ptr<MockInstallerState> installer_state( | |
| 515 BuildChromeInstallerState(system_level, multi_install, | |
| 516 *installation_state, | |
| 517 InstallerState::MULTI_INSTALL)); | |
| 518 | |
| 519 EXPECT_CALL(work_item_list, AddDeleteRegKeyWorkItem(_, _)).Times(0); | |
| 520 EXPECT_CALL(work_item_list, AddCreateRegKeyWorkItem(_, _)).Times(0); | |
| 521 EXPECT_CALL(work_item_list, AddSetRegDwordValueWorkItem(_, _, _, _, _)) | |
| 522 .Times(0); | |
| 523 EXPECT_CALL(work_item_list, AddSetRegStringValueWorkItem(_, _, _, _, _)) | |
| 524 .Times(0); | |
| 525 | |
| 526 AddElevationPolicyWorkItems(*installation_state.get(), | |
| 527 *installer_state.get(), | |
| 528 *new_version_.get(), | |
| 529 &work_item_list); | |
| 530 } | |
| 531 | 491 |
| 532 TEST_F(InstallWorkerTest, GoogleUpdateWorkItemsTest) { | 492 TEST_F(InstallWorkerTest, GoogleUpdateWorkItemsTest) { |
| 533 const bool system_level = true; | 493 const bool system_level = true; |
| 534 const bool multi_install = true; | 494 const bool multi_install = true; |
| 535 MockWorkItemList work_item_list; | 495 MockWorkItemList work_item_list; |
| 536 | 496 |
| 537 scoped_ptr<MockInstallationState> installation_state( | 497 scoped_ptr<MockInstallationState> installation_state( |
| 538 BuildChromeInstallationState(system_level, multi_install)); | 498 BuildChromeInstallationState(system_level, false)); |
| 539 | 499 |
| 540 MockProductState cf_state; | 500 MockProductState cf_state; |
| 541 cf_state.set_version(current_version_->Clone()); | 501 cf_state.set_version(current_version_->Clone()); |
| 542 cf_state.set_multi_install(false); | 502 cf_state.set_multi_install(false); |
| 543 | 503 |
| 544 installation_state->SetProductState(system_level, | 504 installation_state->SetProductState(system_level, |
| 545 BrowserDistribution::CHROME_FRAME, cf_state); | 505 BrowserDistribution::CHROME_FRAME, cf_state); |
| 546 | 506 |
| 547 scoped_ptr<MockInstallerState> installer_state( | 507 scoped_ptr<MockInstallerState> installer_state( |
| 548 BuildChromeInstallerState(system_level, multi_install, | 508 BuildChromeInstallerState(system_level, multi_install, |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 machine_state_.get()); | 845 machine_state_.get()); |
| 886 scoped_ptr<MockInstallerState> installer_state( | 846 scoped_ptr<MockInstallerState> installer_state( |
| 887 BuildBasicInstallerState(system_level_, true, *machine_state_, | 847 BuildBasicInstallerState(system_level_, true, *machine_state_, |
| 888 InstallerState::UNINSTALL)); | 848 InstallerState::UNINSTALL)); |
| 889 AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get()); | 849 AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get()); |
| 890 AddQuickEnableWorkItems(*installer_state, *machine_state_, &setup_path_, | 850 AddQuickEnableWorkItems(*installer_state, *machine_state_, &setup_path_, |
| 891 new_version_.get(), &work_item_list_); | 851 new_version_.get(), &work_item_list_); |
| 892 } | 852 } |
| 893 | 853 |
| 894 #endif // defined(GOOGLE_CHROME_BUILD) | 854 #endif // defined(GOOGLE_CHROME_BUILD) |
| OLD | NEW |