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

Side by Side Diff: chrome/installer/setup/install_worker_unittest.cc

Issue 10912096: C++ reability review for gab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile errors Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/installer/setup/install_worker.cc ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 // TODO(robertshield): Set up some real expectations. 453 // TODO(robertshield): Set up some real expectations.
454 EXPECT_CALL(work_item_list, AddCopyTreeWorkItem(_, _, _, _, _)) 454 EXPECT_CALL(work_item_list, AddCopyTreeWorkItem(_, _, _, _, _))
455 .Times(AtLeast(1)); 455 .Times(AtLeast(1));
456 456
457 AddInstallWorkItems(*installation_state.get(), 457 AddInstallWorkItems(*installation_state.get(),
458 *installer_state.get(), 458 *installer_state.get(),
459 setup_path_, 459 setup_path_,
460 archive_path_, 460 archive_path_,
461 src_path_, 461 src_path_,
462 temp_dir_, 462 temp_dir_,
463 current_version_.get(),
463 *new_version_.get(), 464 *new_version_.get(),
464 &current_version_,
465 &work_item_list); 465 &work_item_list);
466 } 466 }
467 467
468 namespace { 468 namespace {
469 469
470 const wchar_t elevation_key[] = 470 const wchar_t elevation_key[] =
471 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\" 471 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"
472 L"{E0A900DF-9611-4446-86BD-4B1D47E7DB2A}"; 472 L"{E0A900DF-9611-4446-86BD-4B1D47E7DB2A}";
473 const wchar_t old_elevation_key[] = 473 const wchar_t old_elevation_key[] =
474 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\" 474 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 L"Software\\Google\\Update\\Clients\\" 717 L"Software\\Google\\Update\\Clients\\"
718 L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}\\Commands\\quick-enable-cf"; 718 L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}\\Commands\\quick-enable-cf";
719 719
720 TEST_F(QuickEnableAbsentTest, CleanInstallSingleChrome) { 720 TEST_F(QuickEnableAbsentTest, CleanInstallSingleChrome) {
721 // Install single Chrome on a clean system. 721 // Install single Chrome on a clean system.
722 scoped_ptr<MockInstallerState> installer_state( 722 scoped_ptr<MockInstallerState> installer_state(
723 BuildChromeInstallerState(system_level_, false, *machine_state_, 723 BuildChromeInstallerState(system_level_, false, *machine_state_,
724 InstallerState::SINGLE_INSTALL_OR_UPDATE)); 724 InstallerState::SINGLE_INSTALL_OR_UPDATE));
725 AddQuickEnableChromeFrameWorkItems(*installer_state, 725 AddQuickEnableChromeFrameWorkItems(*installer_state,
726 *machine_state_, 726 *machine_state_,
727 &setup_path_, 727 setup_path_,
728 new_version_.get(), 728 *new_version_.get(),
729 &work_item_list_); 729 &work_item_list_);
730 } 730 }
731 731
732 TEST_F(QuickEnableAbsentTest, CleanInstallSingleChromeFrame) { 732 TEST_F(QuickEnableAbsentTest, CleanInstallSingleChromeFrame) {
733 // Install single Chrome Frame on a clean system. 733 // Install single Chrome Frame on a clean system.
734 scoped_ptr<MockInstallerState> installer_state( 734 scoped_ptr<MockInstallerState> installer_state(
735 BuildChromeFrameInstallerState(system_level_, false, false, 735 BuildChromeFrameInstallerState(system_level_, false, false,
736 *machine_state_, 736 *machine_state_,
737 InstallerState::SINGLE_INSTALL_OR_UPDATE)); 737 InstallerState::SINGLE_INSTALL_OR_UPDATE));
738 AddQuickEnableChromeFrameWorkItems(*installer_state, 738 AddQuickEnableChromeFrameWorkItems(*installer_state,
739 *machine_state_, 739 *machine_state_,
740 &setup_path_, 740 setup_path_,
741 new_version_.get(), 741 *new_version_.get(),
742 &work_item_list_); 742 &work_item_list_);
743 } 743 }
744 744
745 TEST_F(QuickEnableAbsentTest, CleanInstallMultiChromeFrame) { 745 TEST_F(QuickEnableAbsentTest, CleanInstallMultiChromeFrame) {
746 // Install multi Chrome Frame on a clean system. 746 // Install multi Chrome Frame on a clean system.
747 scoped_ptr<MockInstallerState> installer_state( 747 scoped_ptr<MockInstallerState> installer_state(
748 BuildChromeFrameInstallerState(system_level_, true, false, 748 BuildChromeFrameInstallerState(system_level_, true, false,
749 *machine_state_, 749 *machine_state_,
750 InstallerState::MULTI_INSTALL)); 750 InstallerState::MULTI_INSTALL));
751 AddQuickEnableChromeFrameWorkItems(*installer_state, 751 AddQuickEnableChromeFrameWorkItems(*installer_state,
752 *machine_state_, 752 *machine_state_,
753 &setup_path_, 753 setup_path_,
754 new_version_.get(), 754 *new_version_.get(),
755 &work_item_list_); 755 &work_item_list_);
756 } 756 }
757 757
758 TEST_F(QuickEnableAbsentTest, CleanInstallMultiChromeChromeFrame) { 758 TEST_F(QuickEnableAbsentTest, CleanInstallMultiChromeChromeFrame) {
759 // Install multi Chrome and Chrome Frame on a clean system. 759 // Install multi Chrome and Chrome Frame on a clean system.
760 scoped_ptr<MockInstallerState> installer_state( 760 scoped_ptr<MockInstallerState> installer_state(
761 BuildBasicInstallerState(system_level_, true, *machine_state_, 761 BuildBasicInstallerState(system_level_, true, *machine_state_,
762 InstallerState::MULTI_INSTALL)); 762 InstallerState::MULTI_INSTALL));
763 AddChromeBinariesToInstallerState(*machine_state_, installer_state.get()); 763 AddChromeBinariesToInstallerState(*machine_state_, installer_state.get());
764 AddChromeToInstallerState(*machine_state_, installer_state.get()); 764 AddChromeToInstallerState(*machine_state_, installer_state.get());
765 AddChromeFrameToInstallerState(*machine_state_, false, 765 AddChromeFrameToInstallerState(*machine_state_, false,
766 installer_state.get()); 766 installer_state.get());
767 AddQuickEnableChromeFrameWorkItems(*installer_state, 767 AddQuickEnableChromeFrameWorkItems(*installer_state,
768 *machine_state_, 768 *machine_state_,
769 &setup_path_, 769 setup_path_,
770 new_version_.get(), 770 *new_version_.get(),
771 &work_item_list_); 771 &work_item_list_);
772 } 772 }
773 773
774 TEST_F(QuickEnableAbsentTest, UninstallMultiChromeLeaveMultiChromeFrame) { 774 TEST_F(QuickEnableAbsentTest, UninstallMultiChromeLeaveMultiChromeFrame) {
775 // Uninstall multi Chrome on a machine with multi Chrome Frame. 775 // Uninstall multi Chrome on a machine with multi Chrome Frame.
776 AddChromeToInstallationState(system_level_, true, false, 776 AddChromeToInstallationState(system_level_, true, false,
777 machine_state_.get()); 777 machine_state_.get());
778 AddChromeFrameToInstallationState(system_level_, true, false, 778 AddChromeFrameToInstallationState(system_level_, true, false,
779 machine_state_.get()); 779 machine_state_.get());
780 scoped_ptr<MockInstallerState> installer_state( 780 scoped_ptr<MockInstallerState> installer_state(
781 BuildBasicInstallerState(system_level_, true, *machine_state_, 781 BuildBasicInstallerState(system_level_, true, *machine_state_,
782 InstallerState::UNINSTALL)); 782 InstallerState::UNINSTALL));
783 AddChromeToInstallerState(*machine_state_, installer_state.get()); 783 AddChromeToInstallerState(*machine_state_, installer_state.get());
784 AddQuickEnableChromeFrameWorkItems(*installer_state, 784 AddQuickEnableChromeFrameWorkItems(*installer_state,
785 *machine_state_, 785 *machine_state_,
786 &setup_path_, 786 setup_path_,
787 new_version_.get(), 787 *new_version_.get(),
788 &work_item_list_); 788 &work_item_list_);
789 } 789 }
790 790
791 TEST_F(QuickEnableAbsentTest, UninstallMultiChromeLeaveSingleChromeFrame) { 791 TEST_F(QuickEnableAbsentTest, UninstallMultiChromeLeaveSingleChromeFrame) {
792 // Uninstall multi Chrome on a machine with single Chrome Frame. 792 // Uninstall multi Chrome on a machine with single Chrome Frame.
793 AddChromeToInstallationState(system_level_, true, false, 793 AddChromeToInstallationState(system_level_, true, false,
794 machine_state_.get()); 794 machine_state_.get());
795 AddChromeFrameToInstallationState(system_level_, false, false, 795 AddChromeFrameToInstallationState(system_level_, false, false,
796 machine_state_.get()); 796 machine_state_.get());
797 scoped_ptr<MockInstallerState> installer_state( 797 scoped_ptr<MockInstallerState> installer_state(
798 BuildBasicInstallerState(system_level_, true, *machine_state_, 798 BuildBasicInstallerState(system_level_, true, *machine_state_,
799 InstallerState::UNINSTALL)); 799 InstallerState::UNINSTALL));
800 AddChromeToInstallerState(*machine_state_, installer_state.get()); 800 AddChromeToInstallerState(*machine_state_, installer_state.get());
801 AddChromeBinariesToInstallerState(*machine_state_, installer_state.get()); 801 AddChromeBinariesToInstallerState(*machine_state_, installer_state.get());
802 AddQuickEnableChromeFrameWorkItems(*installer_state, 802 AddQuickEnableChromeFrameWorkItems(*installer_state,
803 *machine_state_, 803 *machine_state_,
804 &setup_path_, 804 setup_path_,
805 new_version_.get(), 805 *new_version_.get(),
806 &work_item_list_); 806 &work_item_list_);
807 } 807 }
808 808
809 TEST_F(QuickEnableAbsentTest, AcceptReadyMode) { 809 TEST_F(QuickEnableAbsentTest, AcceptReadyMode) {
810 // Accept ready-mode. 810 // Accept ready-mode.
811 AddChromeToInstallationState(system_level_, true, true, 811 AddChromeToInstallationState(system_level_, true, true,
812 machine_state_.get()); 812 machine_state_.get());
813 AddChromeFrameToInstallationState(system_level_, true, true, 813 AddChromeFrameToInstallationState(system_level_, true, true,
814 machine_state_.get()); 814 machine_state_.get());
815 scoped_ptr<MockInstallerState> installer_state( 815 scoped_ptr<MockInstallerState> installer_state(
816 BuildBasicInstallerState(system_level_, true, *machine_state_, 816 BuildBasicInstallerState(system_level_, true, *machine_state_,
817 InstallerState::UNINSTALL)); 817 InstallerState::UNINSTALL));
818 AddChromeToInstallerState(*machine_state_, installer_state.get()); 818 AddChromeToInstallerState(*machine_state_, installer_state.get());
819 AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get()); 819 AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get());
820 AddChromeBinariesToInstallerState(*machine_state_, installer_state.get()); 820 AddChromeBinariesToInstallerState(*machine_state_, installer_state.get());
821 AddQuickEnableChromeFrameWorkItems(*installer_state, 821 AddQuickEnableChromeFrameWorkItems(*installer_state,
822 *machine_state_, 822 *machine_state_,
823 &setup_path_, 823 setup_path_,
824 new_version_.get(), 824 *new_version_.get(),
825 &work_item_list_); 825 &work_item_list_);
826 } 826 }
827 827
828 // Test scenarios under which the quick-enable-cf command should exist after the 828 // Test scenarios under which the quick-enable-cf command should exist after the
829 // run. 829 // run.
830 class QuickEnablePresentTest : public InstallWorkerTest { 830 class QuickEnablePresentTest : public InstallWorkerTest {
831 public: 831 public:
832 virtual void SetUp() { 832 virtual void SetUp() {
833 InstallWorkerTest::SetUp(); 833 InstallWorkerTest::SetUp();
834 root_key_ = system_level_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 834 root_key_ = system_level_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 L"Software\\Google\\Update\\Clients\\" 878 L"Software\\Google\\Update\\Clients\\"
879 L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}\\Commands\\quick-enable-cf"; 879 L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}\\Commands\\quick-enable-cf";
880 880
881 TEST_F(QuickEnablePresentTest, CleanInstallMultiChrome) { 881 TEST_F(QuickEnablePresentTest, CleanInstallMultiChrome) {
882 // Install multi Chrome on a clean system. 882 // Install multi Chrome on a clean system.
883 scoped_ptr<MockInstallerState> installer_state( 883 scoped_ptr<MockInstallerState> installer_state(
884 BuildChromeInstallerState(system_level_, true, *machine_state_, 884 BuildChromeInstallerState(system_level_, true, *machine_state_,
885 InstallerState::MULTI_INSTALL)); 885 InstallerState::MULTI_INSTALL));
886 AddQuickEnableChromeFrameWorkItems(*installer_state, 886 AddQuickEnableChromeFrameWorkItems(*installer_state,
887 *machine_state_, 887 *machine_state_,
888 &setup_path_, 888 setup_path_,
889 new_version_.get(), 889 *new_version_.get(),
890 &work_item_list_); 890 &work_item_list_);
891 } 891 }
892 892
893 TEST_F(QuickEnablePresentTest, CleanInstallMultiChromeReadyMode) { 893 TEST_F(QuickEnablePresentTest, CleanInstallMultiChromeReadyMode) {
894 // Install multi Chrome with Chrome Frame ready-mode on a clean system. 894 // Install multi Chrome with Chrome Frame ready-mode on a clean system.
895 scoped_ptr<MockInstallerState> installer_state( 895 scoped_ptr<MockInstallerState> installer_state(
896 BuildBasicInstallerState(system_level_, true, *machine_state_, 896 BuildBasicInstallerState(system_level_, true, *machine_state_,
897 InstallerState::MULTI_INSTALL)); 897 InstallerState::MULTI_INSTALL));
898 AddChromeBinariesToInstallerState(*machine_state_, installer_state.get()); 898 AddChromeBinariesToInstallerState(*machine_state_, installer_state.get());
899 AddChromeToInstallerState(*machine_state_, installer_state.get()); 899 AddChromeToInstallerState(*machine_state_, installer_state.get());
900 AddChromeFrameToInstallerState(*machine_state_, true, 900 AddChromeFrameToInstallerState(*machine_state_, true,
901 installer_state.get()); 901 installer_state.get());
902 AddQuickEnableChromeFrameWorkItems(*installer_state, 902 AddQuickEnableChromeFrameWorkItems(*installer_state,
903 *machine_state_, 903 *machine_state_,
904 &setup_path_, 904 setup_path_,
905 new_version_.get(), 905 *new_version_.get(),
906 &work_item_list_); 906 &work_item_list_);
907 } 907 }
908 908
909 TEST_F(QuickEnablePresentTest, UninstallSingleChromeFrame) { 909 TEST_F(QuickEnablePresentTest, UninstallSingleChromeFrame) {
910 // Uninstall single Chrome Frame on a machine with multi Chrome. 910 // Uninstall single Chrome Frame on a machine with multi Chrome.
911 AddChromeToInstallationState(system_level_, true, false, 911 AddChromeToInstallationState(system_level_, true, false,
912 machine_state_.get()); 912 machine_state_.get());
913 AddChromeFrameToInstallationState(system_level_, false, false, 913 AddChromeFrameToInstallationState(system_level_, false, false,
914 machine_state_.get()); 914 machine_state_.get());
915 scoped_ptr<MockInstallerState> installer_state( 915 scoped_ptr<MockInstallerState> installer_state(
916 BuildBasicInstallerState(system_level_, false, *machine_state_, 916 BuildBasicInstallerState(system_level_, false, *machine_state_,
917 InstallerState::UNINSTALL)); 917 InstallerState::UNINSTALL));
918 AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get()); 918 AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get());
919 AddQuickEnableChromeFrameWorkItems(*installer_state, 919 AddQuickEnableChromeFrameWorkItems(*installer_state,
920 *machine_state_, 920 *machine_state_,
921 &setup_path_, 921 setup_path_,
922 new_version_.get(), 922 *new_version_.get(),
923 &work_item_list_); 923 &work_item_list_);
924 } 924 }
925 925
926 TEST_F(QuickEnablePresentTest, UninstallMultiChromeFrame) { 926 TEST_F(QuickEnablePresentTest, UninstallMultiChromeFrame) {
927 // Uninstall multi Chrome Frame on a machine with multi Chrome. 927 // Uninstall multi Chrome Frame on a machine with multi Chrome.
928 AddChromeToInstallationState(system_level_, true, false, 928 AddChromeToInstallationState(system_level_, true, false,
929 machine_state_.get()); 929 machine_state_.get());
930 AddChromeFrameToInstallationState(system_level_, true, false, 930 AddChromeFrameToInstallationState(system_level_, true, false,
931 machine_state_.get()); 931 machine_state_.get());
932 scoped_ptr<MockInstallerState> installer_state( 932 scoped_ptr<MockInstallerState> installer_state(
933 BuildBasicInstallerState(system_level_, true, *machine_state_, 933 BuildBasicInstallerState(system_level_, true, *machine_state_,
934 InstallerState::UNINSTALL)); 934 InstallerState::UNINSTALL));
935 AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get()); 935 AddChromeFrameToInstallerState(*machine_state_, false, installer_state.get());
936 AddQuickEnableChromeFrameWorkItems(*installer_state, 936 AddQuickEnableChromeFrameWorkItems(*installer_state,
937 *machine_state_, 937 *machine_state_,
938 &setup_path_, 938 setup_path_,
939 new_version_.get(), 939 *new_version_.get(),
940 &work_item_list_); 940 &work_item_list_);
941 } 941 }
942 942
943 #endif // defined(GOOGLE_CHROME_BUILD) 943 #endif // defined(GOOGLE_CHROME_BUILD)
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.cc ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698