Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/installer/setup/install_worker.h" | 5 #include "chrome/installer/setup/install_worker.h" |
| 6 | 6 |
| 7 #include <memory> | |
| 8 #include <utility> | |
| 7 #include <vector> | 9 #include <vector> |
| 8 | 10 |
| 11 #include "base/bind.h" | |
| 12 #include "base/callback_helpers.h" | |
| 9 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | |
| 10 #include "base/version.h" | 15 #include "base/version.h" |
| 11 #include "base/win/registry.h" | 16 #include "base/win/registry.h" |
| 12 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
| 18 #include "chrome/install_static/install_details.h" | |
| 19 #include "chrome/install_static/install_modes.h" | |
| 13 #include "chrome/installer/setup/setup_util.h" | 20 #include "chrome/installer/setup/setup_util.h" |
| 14 #include "chrome/installer/util/create_reg_key_work_item.h" | 21 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 15 #include "chrome/installer/util/delete_reg_key_work_item.h" | 22 #include "chrome/installer/util/delete_reg_key_work_item.h" |
| 16 #include "chrome/installer/util/delete_tree_work_item.h" | 23 #include "chrome/installer/util/delete_tree_work_item.h" |
| 17 #include "chrome/installer/util/google_update_constants.h" | 24 #include "chrome/installer/util/google_update_constants.h" |
| 18 #include "chrome/installer/util/helper.h" | 25 #include "chrome/installer/util/helper.h" |
| 19 #include "chrome/installer/util/installation_state.h" | 26 #include "chrome/installer/util/installation_state.h" |
| 20 #include "chrome/installer/util/installer_state.h" | 27 #include "chrome/installer/util/installer_state.h" |
| 21 #include "chrome/installer/util/set_reg_value_work_item.h" | 28 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 22 #include "chrome/installer/util/util_constants.h" | 29 #include "chrome/installer/util/util_constants.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 WorkItem::kWow64Default)); | 472 WorkItem::kWow64Default)); |
| 466 | 473 |
| 467 std::unique_ptr<InstallationState> installation_state( | 474 std::unique_ptr<InstallationState> installation_state( |
| 468 BuildChromeInstallationState(system_level, multi_install)); | 475 BuildChromeInstallationState(system_level, multi_install)); |
| 469 | 476 |
| 470 std::unique_ptr<InstallerState> installer_state(BuildChromeInstallerState( | 477 std::unique_ptr<InstallerState> installer_state(BuildChromeInstallerState( |
| 471 system_level, multi_install, *installation_state, | 478 system_level, multi_install, *installation_state, |
| 472 InstallerState::SINGLE_INSTALL_OR_UPDATE)); | 479 InstallerState::SINGLE_INSTALL_OR_UPDATE)); |
| 473 | 480 |
| 474 // Set up some expectations. | 481 // Set up some expectations. |
| 475 // TODO(robertshield): Set up some real expectations. | 482 // TODO(robertshield): Set up some real expectations. |
|
robertshield
2016/11/04 12:50:35
I don't know what this comment means anymore :-(
grt (UTC plus 2)
2016/11/08 13:02:13
Currently, this test is a bit bogus. It basically
robertshield
2016/11/08 22:03:40
Not really, I agree that is basically an extremely
| |
| 476 EXPECT_CALL(work_item_list, AddCopyTreeWorkItem(_, _, _, _, _)) | 483 EXPECT_CALL(work_item_list, AddCopyTreeWorkItem(_, _, _, _, _)) |
| 477 .Times(AtLeast(1)); | 484 .Times(AtLeast(1)); |
| 478 EXPECT_CALL(work_item_list, AddCreateRegKeyWorkItem(_, _, _)) | 485 EXPECT_CALL(work_item_list, AddCreateRegKeyWorkItem(_, _, _)) |
| 479 .WillRepeatedly(Return(create_reg_key_work_item.get())); | 486 .WillRepeatedly(Return(create_reg_key_work_item.get())); |
| 480 EXPECT_CALL(work_item_list, AddSetRegStringValueWorkItem(_, _, _, _, _, _)) | 487 EXPECT_CALL(work_item_list, AddSetRegStringValueWorkItem(_, _, _, _, _, _)) |
| 481 .WillRepeatedly(Return(set_reg_value_work_item.get())); | 488 .WillRepeatedly(Return(set_reg_value_work_item.get())); |
| 482 EXPECT_CALL(work_item_list, AddDeleteTreeWorkItem(_, _)) | 489 EXPECT_CALL(work_item_list, AddDeleteTreeWorkItem(_, _)) |
| 483 .WillRepeatedly(Return(delete_tree_work_item.get())); | 490 .WillRepeatedly(Return(delete_tree_work_item.get())); |
| 484 EXPECT_CALL(work_item_list, AddDeleteRegKeyWorkItem(_, _, _)) | 491 EXPECT_CALL(work_item_list, AddDeleteRegKeyWorkItem(_, _, _)) |
| 485 .WillRepeatedly(Return(delete_reg_key_work_item.get())); | 492 .WillRepeatedly(Return(delete_reg_key_work_item.get())); |
| 486 | 493 |
| 494 // Install a basic InstallDetails instance and clean it up at the end. | |
| 495 std::unique_ptr<install_static::PrimaryInstallDetails> install_details( | |
| 496 base::MakeUnique<install_static::PrimaryInstallDetails>()); | |
| 497 install_details->set_mode(&install_static::kInstallModes[0]); | |
| 498 install_static::InstallDetails::SetForProcess(std::move(install_details)); | |
| 499 base::ScopedClosureRunner install_details_resetter(base::Bind( | |
| 500 []() { install_static::InstallDetails::SetForProcess(nullptr); })); | |
| 501 | |
| 487 AddInstallWorkItems(*installation_state.get(), | 502 AddInstallWorkItems(*installation_state.get(), |
| 488 *installer_state.get(), | 503 *installer_state.get(), |
| 489 setup_path_, | 504 setup_path_, |
| 490 archive_path_, | 505 archive_path_, |
| 491 src_path_, | 506 src_path_, |
| 492 temp_dir_, | 507 temp_dir_, |
| 493 current_version_.get(), | 508 current_version_.get(), |
| 494 *new_version_.get(), | 509 *new_version_.get(), |
| 495 &work_item_list); | 510 &work_item_list); |
| 496 } | 511 } |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 prod_type_list[i_type_check]); | 836 prod_type_list[i_type_check]); |
| 822 bool prod_expect = (mach_after & (1 << i_type_check)) != 0; | 837 bool prod_expect = (mach_after & (1 << i_type_check)) != 0; |
| 823 EXPECT_EQ(prod_expect, prod_res); | 838 EXPECT_EQ(prod_expect, prod_res); |
| 824 } | 839 } |
| 825 } | 840 } |
| 826 } | 841 } |
| 827 } | 842 } |
| 828 } | 843 } |
| 829 | 844 |
| 830 #endif // defined(GOOGLE_CHROME_BUILD) | 845 #endif // defined(GOOGLE_CHROME_BUILD) |
| OLD | NEW |