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

Side by Side Diff: chrome/browser/google/google_update_win_unittest.cc

Issue 2952133002: Use task runner in version_updater_win.cc. (Closed)
Patch Set: fix nit Created 3 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/google/google_update_win.h" 5 #include "chrome/browser/google/google_update_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlcom.h> 9 #include <atlcom.h>
10 10
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 base::Bind(&GoogleUpdateFactory::Create, 588 base::Bind(&GoogleUpdateFactory::Create,
589 base::Unretained(&mock_google_update_factory_))); 589 base::Unretained(&mock_google_update_factory_)));
590 590
591 // Compute a newer version. 591 // Compute a newer version.
592 base::Version current_version(CHROME_VERSION_STRING); 592 base::Version current_version(CHROME_VERSION_STRING);
593 new_version_ = base::StringPrintf(L"%u.%u.%u.%u", 593 new_version_ = base::StringPrintf(L"%u.%u.%u.%u",
594 current_version.components()[0], 594 current_version.components()[0],
595 current_version.components()[1], 595 current_version.components()[1],
596 current_version.components()[2] + 1, 596 current_version.components()[2] + 1,
597 current_version.components()[3]); 597 current_version.components()[3]);
598
599 SetUpdateDriverTaskRunnerForTesting(task_runner_.get());
gab 2017/07/20 15:51:03 Also set it to nullptr in TearDown() so future tes
598 } 600 }
599 601
600 // Creates app bundle and app mocks that will be used to simulate Google 602 // Creates app bundle and app mocks that will be used to simulate Google
601 // Update. 603 // Update.
602 void MakeGoogleUpdateMocks(CComObject<MockAppBundle>** mock_app_bundle, 604 void MakeGoogleUpdateMocks(CComObject<MockAppBundle>** mock_app_bundle,
603 CComObject<MockApp>** mock_app) { 605 CComObject<MockApp>** mock_app) {
604 CComObject<MockGoogleUpdate>* google_update = 606 CComObject<MockGoogleUpdate>* google_update =
605 mock_google_update_factory_.MakeServerMock(); 607 mock_google_update_factory_.MakeServerMock();
606 CComObject<MockAppBundle>* app_bundle = google_update->MakeAppBundle(); 608 CComObject<MockAppBundle>* app_bundle = google_update->MakeAppBundle();
607 CComObject<MockApp>* app = app_bundle->MakeApp(kChromeGuid); 609 CComObject<MockApp>* app = app_bundle->MakeApp(kChromeGuid);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 base::FilePath dir_temp; 667 base::FilePath dir_temp;
666 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &file_exe)); 668 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &file_exe));
667 ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &dir_temp)); 669 ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &dir_temp));
668 file_exe_override_.reset(); 670 file_exe_override_.reset();
669 file_exe_override_.reset(new base::ScopedPathOverride( 671 file_exe_override_.reset(new base::ScopedPathOverride(
670 base::FILE_EXE, dir_temp.Append(file_exe.BaseName()), 672 base::FILE_EXE, dir_temp.Append(file_exe.BaseName()),
671 true /* is_absolute */, false /* create */)); 673 true /* is_absolute */, false /* create */));
672 674
673 EXPECT_CALL(mock_update_check_delegate_, 675 EXPECT_CALL(mock_update_check_delegate_,
674 OnError(CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY, _, _)); 676 OnError(CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY, _, _));
675 BeginUpdateCheck(task_runner_, std::string(), false, 0, 677 BeginUpdateCheck(std::string(), false, 0,
676 mock_update_check_delegate_.AsWeakPtr()); 678 mock_update_check_delegate_.AsWeakPtr());
677 task_runner_->RunUntilIdle(); 679 task_runner_->RunUntilIdle();
678 } 680 }
679 681
680 // Test the case where the GoogleUpdate class can't be created for an update 682 // Test the case where the GoogleUpdate class can't be created for an update
681 // check. 683 // check.
682 TEST_P(GoogleUpdateWinTest, NoGoogleUpdateForCheck) { 684 TEST_P(GoogleUpdateWinTest, NoGoogleUpdateForCheck) {
683 // The factory should be called upon: let it fail. 685 // The factory should be called upon: let it fail.
684 EXPECT_CALL(mock_google_update_factory_, Create(_)); 686 EXPECT_CALL(mock_google_update_factory_, Create(_));
685 687
686 // Expect the appropriate error when the on-demand class cannot be created. 688 // Expect the appropriate error when the on-demand class cannot be created.
687 EXPECT_CALL(mock_update_check_delegate_, 689 EXPECT_CALL(mock_update_check_delegate_,
688 OnError(GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND, _, _)); 690 OnError(GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND, _, _));
689 BeginUpdateCheck(task_runner_, std::string(), false, 0, 691 BeginUpdateCheck(std::string(), false, 0,
690 mock_update_check_delegate_.AsWeakPtr()); 692 mock_update_check_delegate_.AsWeakPtr());
691 task_runner_->RunUntilIdle(); 693 task_runner_->RunUntilIdle();
692 } 694 }
693 695
694 // Test the case where the GoogleUpdate class can't be created for an upgrade. 696 // Test the case where the GoogleUpdate class can't be created for an upgrade.
695 TEST_P(GoogleUpdateWinTest, NoGoogleUpdateForUpgrade) { 697 TEST_P(GoogleUpdateWinTest, NoGoogleUpdateForUpgrade) {
696 // The factory should be called upon: let it fail. 698 // The factory should be called upon: let it fail.
697 EXPECT_CALL(mock_google_update_factory_, Create(_)); 699 EXPECT_CALL(mock_google_update_factory_, Create(_));
698 700
699 // Expect the appropriate error when the on-demand class cannot be created. 701 // Expect the appropriate error when the on-demand class cannot be created.
700 EXPECT_CALL(mock_update_check_delegate_, 702 EXPECT_CALL(mock_update_check_delegate_,
701 OnError(GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND, _, _)); 703 OnError(GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND, _, _));
702 BeginUpdateCheck(task_runner_, std::string(), true, 0, 704 BeginUpdateCheck(std::string(), true, 0,
703 mock_update_check_delegate_.AsWeakPtr()); 705 mock_update_check_delegate_.AsWeakPtr());
704 task_runner_->RunUntilIdle(); 706 task_runner_->RunUntilIdle();
705 } 707 }
706 708
707 // Test the case where the GoogleUpdate class returns an error when an update 709 // Test the case where the GoogleUpdate class returns an error when an update
708 // check is started. 710 // check is started.
709 TEST_P(GoogleUpdateWinTest, FailUpdateCheck) { 711 TEST_P(GoogleUpdateWinTest, FailUpdateCheck) {
710 CComObject<MockAppBundle>* mock_app_bundle = nullptr; 712 CComObject<MockAppBundle>* mock_app_bundle = nullptr;
711 MakeGoogleUpdateMocks(&mock_app_bundle, nullptr); 713 MakeGoogleUpdateMocks(&mock_app_bundle, nullptr);
712 714
713 // checkForUpdate will fail. 715 // checkForUpdate will fail.
714 EXPECT_CALL(*mock_app_bundle, checkForUpdate()) 716 EXPECT_CALL(*mock_app_bundle, checkForUpdate())
715 .WillOnce(Return(E_FAIL)); 717 .WillOnce(Return(E_FAIL));
716 718
717 EXPECT_CALL(mock_update_check_delegate_, 719 EXPECT_CALL(mock_update_check_delegate_,
718 OnError(GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR, _, _)); 720 OnError(GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR, _, _));
719 BeginUpdateCheck(task_runner_, std::string(), false, 0, 721 BeginUpdateCheck(std::string(), false, 0,
720 mock_update_check_delegate_.AsWeakPtr()); 722 mock_update_check_delegate_.AsWeakPtr());
721 task_runner_->RunUntilIdle(); 723 task_runner_->RunUntilIdle();
722 } 724 }
723 725
724 // Test the case where the GoogleUpdate class reports that updates are disabled 726 // Test the case where the GoogleUpdate class reports that updates are disabled
725 // by Group Policy. 727 // by Group Policy.
726 TEST_P(GoogleUpdateWinTest, UpdatesDisabledByPolicy) { 728 TEST_P(GoogleUpdateWinTest, UpdatesDisabledByPolicy) {
727 static const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY = 0x80040813; 729 static const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY = 0x80040813;
728 730
729 CComObject<MockAppBundle>* mock_app_bundle = nullptr; 731 CComObject<MockAppBundle>* mock_app_bundle = nullptr;
730 CComObject<MockApp>* mock_app = nullptr; 732 CComObject<MockApp>* mock_app = nullptr;
731 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app); 733 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app);
732 734
733 // Expect the bundle to be called on to start the update. 735 // Expect the bundle to be called on to start the update.
734 EXPECT_CALL(*mock_app_bundle, checkForUpdate()) 736 EXPECT_CALL(*mock_app_bundle, checkForUpdate())
735 .WillOnce(Return(S_OK)); 737 .WillOnce(Return(S_OK));
736 738
737 mock_app->PushState(STATE_INIT); 739 mock_app->PushState(STATE_INIT);
738 mock_app->PushState(STATE_CHECKING_FOR_UPDATE); 740 mock_app->PushState(STATE_CHECKING_FOR_UPDATE);
739 mock_app->PushErrorState(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY, 741 mock_app->PushErrorState(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY,
740 L"disabled by policy", -1); 742 L"disabled by policy", -1);
741 743
742 EXPECT_CALL(mock_update_check_delegate_, 744 EXPECT_CALL(mock_update_check_delegate_,
743 OnError(GOOGLE_UPDATE_DISABLED_BY_POLICY, _, _)); 745 OnError(GOOGLE_UPDATE_DISABLED_BY_POLICY, _, _));
744 BeginUpdateCheck(task_runner_, std::string(), false, 0, 746 BeginUpdateCheck(std::string(), false, 0,
745 mock_update_check_delegate_.AsWeakPtr()); 747 mock_update_check_delegate_.AsWeakPtr());
746 task_runner_->RunUntilIdle(); 748 task_runner_->RunUntilIdle();
747 } 749 }
748 750
749 // Test the case where the GoogleUpdate class reports that manual updates are 751 // Test the case where the GoogleUpdate class reports that manual updates are
750 // disabled by Group Policy, but that automatic updates are enabled. 752 // disabled by Group Policy, but that automatic updates are enabled.
751 TEST_P(GoogleUpdateWinTest, ManualUpdatesDisabledByPolicy) { 753 TEST_P(GoogleUpdateWinTest, ManualUpdatesDisabledByPolicy) {
752 static const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL = 754 static const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL =
753 0x8004081f; 755 0x8004081f;
754 756
755 CComObject<MockAppBundle>* mock_app_bundle = nullptr; 757 CComObject<MockAppBundle>* mock_app_bundle = nullptr;
756 CComObject<MockApp>* mock_app = nullptr; 758 CComObject<MockApp>* mock_app = nullptr;
757 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app); 759 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app);
758 760
759 // Expect the bundle to be called on to start the update. 761 // Expect the bundle to be called on to start the update.
760 EXPECT_CALL(*mock_app_bundle, checkForUpdate()) 762 EXPECT_CALL(*mock_app_bundle, checkForUpdate())
761 .WillOnce(Return(S_OK)); 763 .WillOnce(Return(S_OK));
762 764
763 mock_app->PushState(STATE_INIT); 765 mock_app->PushState(STATE_INIT);
764 mock_app->PushState(STATE_CHECKING_FOR_UPDATE); 766 mock_app->PushState(STATE_CHECKING_FOR_UPDATE);
765 mock_app->PushErrorState(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL, 767 mock_app->PushErrorState(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL,
766 L"manual updates disabled by policy", -1); 768 L"manual updates disabled by policy", -1);
767 769
768 EXPECT_CALL(mock_update_check_delegate_, 770 EXPECT_CALL(mock_update_check_delegate_,
769 OnError(GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY, _, _)); 771 OnError(GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY, _, _));
770 BeginUpdateCheck(task_runner_, std::string(), false, 0, 772 BeginUpdateCheck(std::string(), false, 0,
771 mock_update_check_delegate_.AsWeakPtr()); 773 mock_update_check_delegate_.AsWeakPtr());
772 task_runner_->RunUntilIdle(); 774 task_runner_->RunUntilIdle();
773 } 775 }
774 776
775 // Test an update check where no update is available. 777 // Test an update check where no update is available.
776 TEST_P(GoogleUpdateWinTest, UpdateCheckNoUpdate) { 778 TEST_P(GoogleUpdateWinTest, UpdateCheckNoUpdate) {
777 CComObject<MockAppBundle>* mock_app_bundle = nullptr; 779 CComObject<MockAppBundle>* mock_app_bundle = nullptr;
778 CComObject<MockApp>* mock_app = nullptr; 780 CComObject<MockApp>* mock_app = nullptr;
779 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app); 781 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app);
780 782
781 // Expect the bundle to be called on to start the update. 783 // Expect the bundle to be called on to start the update.
782 EXPECT_CALL(*mock_app_bundle, checkForUpdate()) 784 EXPECT_CALL(*mock_app_bundle, checkForUpdate())
783 .WillOnce(Return(S_OK)); 785 .WillOnce(Return(S_OK));
784 786
785 mock_app->PushState(STATE_INIT); 787 mock_app->PushState(STATE_INIT);
786 mock_app->PushState(STATE_CHECKING_FOR_UPDATE); 788 mock_app->PushState(STATE_CHECKING_FOR_UPDATE);
787 mock_app->PushState(STATE_NO_UPDATE); 789 mock_app->PushState(STATE_NO_UPDATE);
788 790
789 EXPECT_CALL(mock_update_check_delegate_, 791 EXPECT_CALL(mock_update_check_delegate_,
790 OnUpdateCheckComplete(IsEmpty())); // new_version 792 OnUpdateCheckComplete(IsEmpty())); // new_version
791 BeginUpdateCheck(task_runner_, std::string(), false, 0, 793 BeginUpdateCheck(std::string(), false, 0,
792 mock_update_check_delegate_.AsWeakPtr()); 794 mock_update_check_delegate_.AsWeakPtr());
793 task_runner_->RunUntilIdle(); 795 task_runner_->RunUntilIdle();
794 } 796 }
795 797
796 // Test an update check where an update is available. 798 // Test an update check where an update is available.
797 TEST_P(GoogleUpdateWinTest, UpdateCheckUpdateAvailable) { 799 TEST_P(GoogleUpdateWinTest, UpdateCheckUpdateAvailable) {
798 CComObject<MockAppBundle>* mock_app_bundle = nullptr; 800 CComObject<MockAppBundle>* mock_app_bundle = nullptr;
799 CComObject<MockApp>* mock_app = nullptr; 801 CComObject<MockApp>* mock_app = nullptr;
800 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app); 802 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app);
801 803
802 // Expect the bundle to be called on to start the update. 804 // Expect the bundle to be called on to start the update.
803 EXPECT_CALL(*mock_app_bundle, checkForUpdate()) 805 EXPECT_CALL(*mock_app_bundle, checkForUpdate())
804 .WillOnce(Return(S_OK)); 806 .WillOnce(Return(S_OK));
805 807
806 mock_app->PushState(STATE_INIT); 808 mock_app->PushState(STATE_INIT);
807 mock_app->PushState(STATE_CHECKING_FOR_UPDATE); 809 mock_app->PushState(STATE_CHECKING_FOR_UPDATE);
808 mock_app->PushUpdateAvailableState(new_version_); 810 mock_app->PushUpdateAvailableState(new_version_);
809 811
810 EXPECT_CALL(mock_update_check_delegate_, 812 EXPECT_CALL(mock_update_check_delegate_,
811 OnUpdateCheckComplete(StrEq(new_version_))); 813 OnUpdateCheckComplete(StrEq(new_version_)));
812 BeginUpdateCheck(task_runner_, std::string(), false, 0, 814 BeginUpdateCheck(std::string(), false, 0,
813 mock_update_check_delegate_.AsWeakPtr()); 815 mock_update_check_delegate_.AsWeakPtr());
814 task_runner_->RunUntilIdle(); 816 task_runner_->RunUntilIdle();
815 } 817 }
816 818
817 // Test a successful upgrade. 819 // Test a successful upgrade.
818 TEST_P(GoogleUpdateWinTest, UpdateInstalled) { 820 TEST_P(GoogleUpdateWinTest, UpdateInstalled) {
819 CComObject<MockAppBundle>* mock_app_bundle = nullptr; 821 CComObject<MockAppBundle>* mock_app_bundle = nullptr;
820 CComObject<MockApp>* mock_app = nullptr; 822 CComObject<MockApp>* mock_app = nullptr;
821 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app); 823 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app);
822 824
(...skipping 24 matching lines...) Expand all
847 OnUpgradeProgress(12, StrEq(new_version_))); 849 OnUpgradeProgress(12, StrEq(new_version_)));
848 EXPECT_CALL(mock_update_check_delegate_, 850 EXPECT_CALL(mock_update_check_delegate_,
849 OnUpgradeProgress(37, StrEq(new_version_))); 851 OnUpgradeProgress(37, StrEq(new_version_)));
850 EXPECT_CALL(mock_update_check_delegate_, 852 EXPECT_CALL(mock_update_check_delegate_,
851 OnUpgradeProgress(50, StrEq(new_version_))); 853 OnUpgradeProgress(50, StrEq(new_version_)));
852 EXPECT_CALL(mock_update_check_delegate_, 854 EXPECT_CALL(mock_update_check_delegate_,
853 OnUpgradeProgress(75, StrEq(new_version_))); 855 OnUpgradeProgress(75, StrEq(new_version_)));
854 EXPECT_CALL(mock_update_check_delegate_, 856 EXPECT_CALL(mock_update_check_delegate_,
855 OnUpgradeComplete(StrEq(new_version_))); 857 OnUpgradeComplete(StrEq(new_version_)));
856 } 858 }
857 BeginUpdateCheck(task_runner_, std::string(), true, 0, 859 BeginUpdateCheck(std::string(), true, 0,
858 mock_update_check_delegate_.AsWeakPtr()); 860 mock_update_check_delegate_.AsWeakPtr());
859 task_runner_->RunUntilIdle(); 861 task_runner_->RunUntilIdle();
860 } 862 }
861 863
862 // Test a failed upgrade where Google Update reports that the installer failed. 864 // Test a failed upgrade where Google Update reports that the installer failed.
863 TEST_P(GoogleUpdateWinTest, UpdateFailed) { 865 TEST_P(GoogleUpdateWinTest, UpdateFailed) {
864 const base::string16 error(L"It didn't work."); 866 const base::string16 error(L"It didn't work.");
865 static const HRESULT GOOPDATEINSTALL_E_INSTALLER_FAILED = 0x80040902; 867 static const HRESULT GOOPDATEINSTALL_E_INSTALLER_FAILED = 0x80040902;
866 static const int kInstallerError = 12; 868 static const int kInstallerError = 12;
867 869
(...skipping 30 matching lines...) Expand all
898 EXPECT_CALL(mock_update_check_delegate_, 900 EXPECT_CALL(mock_update_check_delegate_,
899 OnUpgradeProgress(37, StrEq(new_version_))); 901 OnUpgradeProgress(37, StrEq(new_version_)));
900 EXPECT_CALL(mock_update_check_delegate_, 902 EXPECT_CALL(mock_update_check_delegate_,
901 OnUpgradeProgress(50, StrEq(new_version_))); 903 OnUpgradeProgress(50, StrEq(new_version_)));
902 EXPECT_CALL(mock_update_check_delegate_, 904 EXPECT_CALL(mock_update_check_delegate_,
903 OnUpgradeProgress(75, StrEq(new_version_))); 905 OnUpgradeProgress(75, StrEq(new_version_)));
904 EXPECT_CALL(mock_update_check_delegate_, 906 EXPECT_CALL(mock_update_check_delegate_,
905 OnError(GOOGLE_UPDATE_ERROR_UPDATING, HasSubstr(error), 907 OnError(GOOGLE_UPDATE_ERROR_UPDATING, HasSubstr(error),
906 StrEq(new_version_))); 908 StrEq(new_version_)));
907 } 909 }
908 BeginUpdateCheck(task_runner_, std::string(), true, 0, 910 BeginUpdateCheck(std::string(), true, 0,
909 mock_update_check_delegate_.AsWeakPtr()); 911 mock_update_check_delegate_.AsWeakPtr());
910 task_runner_->RunUntilIdle(); 912 task_runner_->RunUntilIdle();
911 } 913 }
912 914
913 // Test that a retry after a USING_EXTERNAL_UPDATER failure succeeds. 915 // Test that a retry after a USING_EXTERNAL_UPDATER failure succeeds.
914 TEST_P(GoogleUpdateWinTest, RetryAfterExternalUpdaterError) { 916 TEST_P(GoogleUpdateWinTest, RetryAfterExternalUpdaterError) {
915 static const HRESULT GOOPDATE_E_APP_USING_EXTERNAL_UPDATER = 0xa043081d; 917 static const HRESULT GOOPDATE_E_APP_USING_EXTERNAL_UPDATER = 0xa043081d;
916 918
917 CComObject<MockAppBundle>* mock_app_bundle = 919 CComObject<MockAppBundle>* mock_app_bundle =
918 mock_google_update_factory_.MakeServerMock()->MakeAppBundle(); 920 mock_google_update_factory_.MakeServerMock()->MakeAppBundle();
(...skipping 20 matching lines...) Expand all
939 // Expect the bundle to be called on to start the update. 941 // Expect the bundle to be called on to start the update.
940 EXPECT_CALL(*mock_app_bundle, checkForUpdate()).WillOnce(Return(S_OK)); 942 EXPECT_CALL(*mock_app_bundle, checkForUpdate()).WillOnce(Return(S_OK));
941 943
942 mock_app->PushState(STATE_INIT); 944 mock_app->PushState(STATE_INIT);
943 mock_app->PushState(STATE_CHECKING_FOR_UPDATE); 945 mock_app->PushState(STATE_CHECKING_FOR_UPDATE);
944 mock_app->PushState(STATE_NO_UPDATE); 946 mock_app->PushState(STATE_NO_UPDATE);
945 947
946 // Expect the update check to succeed. 948 // Expect the update check to succeed.
947 EXPECT_CALL(mock_update_check_delegate_, 949 EXPECT_CALL(mock_update_check_delegate_,
948 OnUpdateCheckComplete(IsEmpty())); // new_version 950 OnUpdateCheckComplete(IsEmpty())); // new_version
949 BeginUpdateCheck(task_runner_, std::string(), false, 0, 951 BeginUpdateCheck(std::string(), false, 0,
950 mock_update_check_delegate_.AsWeakPtr()); 952 mock_update_check_delegate_.AsWeakPtr());
951 task_runner_->RunUntilIdle(); 953 task_runner_->RunUntilIdle();
952 } 954 }
953 955
954 TEST_P(GoogleUpdateWinTest, UpdateInstalledMultipleDelegates) { 956 TEST_P(GoogleUpdateWinTest, UpdateInstalledMultipleDelegates) {
955 CComObject<MockAppBundle>* mock_app_bundle = nullptr; 957 CComObject<MockAppBundle>* mock_app_bundle = nullptr;
956 CComObject<MockApp>* mock_app = nullptr; 958 CComObject<MockApp>* mock_app = nullptr;
957 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app); 959 MakeGoogleUpdateMocks(&mock_app_bundle, &mock_app);
958 960
959 // Expect the bundle to be called on to start the update. 961 // Expect the bundle to be called on to start the update.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 EXPECT_CALL(mock_update_check_delegate_, 1001 EXPECT_CALL(mock_update_check_delegate_,
1000 OnUpgradeProgress(75, StrEq(new_version_))); 1002 OnUpgradeProgress(75, StrEq(new_version_)));
1001 EXPECT_CALL(mock_update_check_delegate_2, 1003 EXPECT_CALL(mock_update_check_delegate_2,
1002 OnUpgradeProgress(75, StrEq(new_version_))); 1004 OnUpgradeProgress(75, StrEq(new_version_)));
1003 1005
1004 EXPECT_CALL(mock_update_check_delegate_, 1006 EXPECT_CALL(mock_update_check_delegate_,
1005 OnUpgradeComplete(StrEq(new_version_))); 1007 OnUpgradeComplete(StrEq(new_version_)));
1006 EXPECT_CALL(mock_update_check_delegate_2, 1008 EXPECT_CALL(mock_update_check_delegate_2,
1007 OnUpgradeComplete(StrEq(new_version_))); 1009 OnUpgradeComplete(StrEq(new_version_)));
1008 } 1010 }
1009 BeginUpdateCheck(task_runner_, std::string(), true, 0, 1011 BeginUpdateCheck(std::string(), true, 0,
1010 mock_update_check_delegate_.AsWeakPtr()); 1012 mock_update_check_delegate_.AsWeakPtr());
1011 BeginUpdateCheck(task_runner_, std::string(), true, 0, 1013 BeginUpdateCheck(std::string(), true, 0,
1012 mock_update_check_delegate_2.AsWeakPtr()); 1014 mock_update_check_delegate_2.AsWeakPtr());
1013 task_runner_->RunUntilIdle(); 1015 task_runner_->RunUntilIdle();
1014 } 1016 }
1015 1017
1016 INSTANTIATE_TEST_CASE_P(UserLevel, GoogleUpdateWinTest, Values(false)); 1018 INSTANTIATE_TEST_CASE_P(UserLevel, GoogleUpdateWinTest, Values(false));
1017 1019
1018 INSTANTIATE_TEST_CASE_P(SystemLevel, GoogleUpdateWinTest, Values(true)); 1020 INSTANTIATE_TEST_CASE_P(SystemLevel, GoogleUpdateWinTest, Values(true));
OLDNEW
« no previous file with comments | « chrome/browser/google/google_update_win.cc ('k') | chrome/browser/ui/webui/help/version_updater_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698