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

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

Issue 2318073002: Revert "Move on-demand update checks from the FILE thread to the blocking pool." (Closed)
Patch Set: sync to position 416913 Created 4 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
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
11 #include <map>
12 #include <memory> 11 #include <memory>
13 #include <queue> 12 #include <queue>
14 13
15 #include "base/base_paths.h" 14 #include "base/base_paths.h"
16 #include "base/bind.h" 15 #include "base/bind.h"
17 #include "base/macros.h" 16 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
19 #include "base/path_service.h" 18 #include "base/path_service.h"
20 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
21 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
22 #include "base/test/scoped_path_override.h" 21 #include "base/test/scoped_path_override.h"
23 #include "base/test/test_reg_util_win.h" 22 #include "base/test/test_reg_util_win.h"
24 #include "base/test/test_simple_task_runner.h" 23 #include "base/test/test_simple_task_runner.h"
25 #include "base/threading/thread_task_runner_handle.h" 24 #include "base/threading/thread_task_runner_handle.h"
26 #include "base/version.h" 25 #include "base/version.h"
27 #include "base/win/registry.h" 26 #include "base/win/registry.h"
28 #include "base/win/scoped_com_initializer.h"
29 #include "base/win/scoped_comptr.h" 27 #include "base/win/scoped_comptr.h"
30 #include "chrome/common/chrome_version.h" 28 #include "chrome/common/chrome_version.h"
31 #include "chrome/installer/util/browser_distribution.h" 29 #include "chrome/installer/util/browser_distribution.h"
32 #include "chrome/installer/util/google_update_settings.h" 30 #include "chrome/installer/util/google_update_settings.h"
33 #include "chrome/installer/util/helper.h" 31 #include "chrome/installer/util/helper.h"
34 #include "google_update/google_update_idl.h" 32 #include "google_update/google_update_idl.h"
35 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
36 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
37 #include "ui/base/win/atl_module.h" 35 #include "ui/base/win/atl_module.h"
38 36
39 using ::testing::DoAll; 37 using ::testing::DoAll;
40 using ::testing::HasSubstr; 38 using ::testing::HasSubstr;
41 using ::testing::InSequence; 39 using ::testing::InSequence;
42 using ::testing::InvokeWithoutArgs;
43 using ::testing::IsEmpty; 40 using ::testing::IsEmpty;
44 using ::testing::Return; 41 using ::testing::Return;
45 using ::testing::Sequence; 42 using ::testing::Sequence;
46 using ::testing::SetArgPointee; 43 using ::testing::SetArgPointee;
47 using ::testing::StrEq; 44 using ::testing::StrEq;
48 using ::testing::StrictMock; 45 using ::testing::StrictMock;
49 using ::testing::Values; 46 using ::testing::Values;
50 using ::testing::_; 47 using ::testing::_;
51 48
52 namespace { 49 namespace {
(...skipping 12 matching lines...) Expand all
65 MOCK_METHOD3(OnError, void(GoogleUpdateErrorCode, 62 MOCK_METHOD3(OnError, void(GoogleUpdateErrorCode,
66 const base::string16&, 63 const base::string16&,
67 const base::string16&)); 64 const base::string16&));
68 65
69 private: 66 private:
70 base::WeakPtrFactory<UpdateCheckDelegate> weak_ptr_factory_; 67 base::WeakPtrFactory<UpdateCheckDelegate> weak_ptr_factory_;
71 68
72 DISALLOW_COPY_AND_ASSIGN(MockUpdateCheckDelegate); 69 DISALLOW_COPY_AND_ASSIGN(MockUpdateCheckDelegate);
73 }; 70 };
74 71
75 // A fake implementation of the COM IGlobalInterfaceTable that holds and hands
76 // out object pointers.
77 class FakeGlobalInterfaceTable : public CComObjectRootEx<CComSingleThreadModel>,
78 public IGlobalInterfaceTable {
79 public:
80 BEGIN_COM_MAP(FakeGlobalInterfaceTable)
81 COM_INTERFACE_ENTRY(IGlobalInterfaceTable)
82 END_COM_MAP()
83
84 FakeGlobalInterfaceTable() = default;
85
86 HRESULT STDMETHODCALLTYPE RegisterInterfaceInGlobal(IUnknown* object,
87 REFIID,
88 DWORD* cookie) override {
89 objects_[++last_cookie_] = object;
90 *cookie = last_cookie_;
91 return S_OK;
92 }
93
94 HRESULT STDMETHODCALLTYPE RevokeInterfaceFromGlobal(DWORD cookie) override {
95 return objects_.erase(cookie) ? S_OK : E_INVALIDARG;
96 }
97
98 HRESULT STDMETHODCALLTYPE GetInterfaceFromGlobal(DWORD cookie,
99 REFIID,
100 void** object) override {
101 auto it = objects_.find(cookie);
102 if (it == objects_.end())
103 return E_INVALIDARG;
104 it->second.get()->AddRef();
105 *object = it->second.get();
106 return S_OK;
107 }
108
109 size_t empty() const { return objects_.empty(); }
110
111 private:
112 using CookieToObjectMap = std::map<DWORD, base::win::ScopedComPtr<IUnknown>>;
113
114 CookieToObjectMap objects_;
115 DWORD last_cookie_ = 0;
116
117 DISALLOW_COPY_AND_ASSIGN(FakeGlobalInterfaceTable);
118 };
119
120 // An interface that exposes a factory method for creating an IGoogleUpdate3Web 72 // An interface that exposes a factory method for creating an IGoogleUpdate3Web
121 // instance. 73 // instance.
122 class GoogleUpdateFactory { 74 class GoogleUpdateFactory {
123 public: 75 public:
124 virtual ~GoogleUpdateFactory() {} 76 virtual ~GoogleUpdateFactory() {}
125 virtual HRESULT Create( 77 virtual HRESULT Create(
126 base::win::ScopedComPtr<IGoogleUpdate3Web>* google_update) = 0; 78 base::win::ScopedComPtr<IGoogleUpdate3Web>* google_update) = 0;
127 }; 79 };
128 80
129 class MockCurrentState : public CComObjectRootEx<CComSingleThreadModel>, 81 class MockCurrentState : public CComObjectRootEx<CComSingleThreadModel>,
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // in setting up expectations until a consumer obtains it via get_appWeb, at 411 // in setting up expectations until a consumer obtains it via get_appWeb, at
460 // which time it is owned by the consumer. 412 // which time it is owned by the consumer.
461 CComObject<MockApp>* MakeApp(const base::char16* app_guid) { 413 CComObject<MockApp>* MakeApp(const base::char16* app_guid) {
462 // The bundle will be called on to create the installed app. 414 // The bundle will be called on to create the installed app.
463 EXPECT_CALL(*this, createInstalledApp(StrEq(app_guid))) 415 EXPECT_CALL(*this, createInstalledApp(StrEq(app_guid)))
464 .WillOnce(Return(S_OK)); 416 .WillOnce(Return(S_OK));
465 417
466 CComObject<MockApp>* mock_app = nullptr; 418 CComObject<MockApp>* mock_app = nullptr;
467 EXPECT_EQ(S_OK, CComObject<MockApp>::CreateInstance(&mock_app)); 419 EXPECT_EQ(S_OK, CComObject<MockApp>::CreateInstance(&mock_app));
468 420
421 // Give mock_app_bundle a ref to the app which it will return when asked.
469 // Note: to support multiple apps, get_appWeb expectations should use 422 // Note: to support multiple apps, get_appWeb expectations should use
470 // successive indices. 423 // successive indices.
471 app_ = mock_app; 424 mock_app->AddRef();
472 EXPECT_CALL(*this, get_appWeb(0, _)) 425 EXPECT_CALL(*this, get_appWeb(0, _))
473 .WillRepeatedly( 426 .WillOnce(DoAll(SetArgPointee<1>(mock_app),
474 DoAll(SetArgPointee<1>(mock_app), 427 Return(S_OK)));
475 InvokeWithoutArgs(mock_app, &CComObject<MockApp>::AddRef)));
476 428
477 return mock_app; 429 return mock_app;
478 } 430 }
479 431
480 private: 432 private:
481 base::win::ScopedComPtr<IAppWeb> app_;
482
483 DISALLOW_COPY_AND_ASSIGN(MockAppBundle); 433 DISALLOW_COPY_AND_ASSIGN(MockAppBundle);
484 }; 434 };
485 435
486 // A mock IGoogleUpdate3Web that can handle a call to initialize and 436 // A mock IGoogleUpdate3Web that can handle a call to initialize and
487 // createAppBundleWeb by consumers. 437 // createAppBundleWeb by consumers.
488 class MockGoogleUpdate : public CComObjectRootEx<CComSingleThreadModel>, 438 class MockGoogleUpdate : public CComObjectRootEx<CComSingleThreadModel>,
489 public IGoogleUpdate3Web { 439 public IGoogleUpdate3Web {
490 public: 440 public:
491 BEGIN_COM_MAP(MockGoogleUpdate) 441 BEGIN_COM_MAP(MockGoogleUpdate)
492 COM_INTERFACE_ENTRY(IGoogleUpdate3Web) 442 COM_INTERFACE_ENTRY(IGoogleUpdate3Web)
(...skipping 27 matching lines...) Expand all
520 // at which time it is owned by the consumer. 470 // at which time it is owned by the consumer.
521 CComObject<MockAppBundle>* MakeAppBundle() { 471 CComObject<MockAppBundle>* MakeAppBundle() {
522 CComObject<MockAppBundle>* mock_app_bundle = nullptr; 472 CComObject<MockAppBundle>* mock_app_bundle = nullptr;
523 EXPECT_EQ(S_OK, 473 EXPECT_EQ(S_OK,
524 CComObject<MockAppBundle>::CreateInstance(&mock_app_bundle)); 474 CComObject<MockAppBundle>::CreateInstance(&mock_app_bundle));
525 EXPECT_CALL(*mock_app_bundle, initialize()) 475 EXPECT_CALL(*mock_app_bundle, initialize())
526 .WillOnce(Return(S_OK)); 476 .WillOnce(Return(S_OK));
527 // Give this instance a ref to the bundle which it will return when created. 477 // Give this instance a ref to the bundle which it will return when created.
528 mock_app_bundle->AddRef(); 478 mock_app_bundle->AddRef();
529 EXPECT_CALL(*this, createAppBundleWeb(_)) 479 EXPECT_CALL(*this, createAppBundleWeb(_))
530 .InSequence(sequence_)
531 .WillOnce(DoAll(SetArgPointee<0>(mock_app_bundle), Return(S_OK))); 480 .WillOnce(DoAll(SetArgPointee<0>(mock_app_bundle), Return(S_OK)));
532 return mock_app_bundle; 481 return mock_app_bundle;
533 } 482 }
534 483
535 private: 484 private:
536 Sequence sequence_;
537
538 DISALLOW_COPY_AND_ASSIGN(MockGoogleUpdate); 485 DISALLOW_COPY_AND_ASSIGN(MockGoogleUpdate);
539 }; 486 };
540 487
541 // A mock factory for creating an IGoogleUpdate3Web instance. 488 // A mock factory for creating an IGoogleUpdate3Web instance.
542 class MockGoogleUpdateFactory : public GoogleUpdateFactory { 489 class MockGoogleUpdateFactory : public GoogleUpdateFactory {
543 public: 490 public:
544 MockGoogleUpdateFactory() {} 491 MockGoogleUpdateFactory() {}
545 MOCK_METHOD1(Create, HRESULT(base::win::ScopedComPtr<IGoogleUpdate3Web>*)); 492 MOCK_METHOD1(Create, HRESULT(base::win::ScopedComPtr<IGoogleUpdate3Web>*));
546 493
547 // Returns a mock IGoogleUpdate3Web object that will be returned by the 494 // Returns a mock IGoogleUpdate3Web object that will be returned by the
(...skipping 29 matching lines...) Expand all
577 // Configure all mock functions that return HRESULT to return failure. 524 // Configure all mock functions that return HRESULT to return failure.
578 ::testing::DefaultValue<HRESULT>::Set(E_FAIL); 525 ::testing::DefaultValue<HRESULT>::Set(E_FAIL);
579 } 526 }
580 527
581 static void TearDownTestCase() { ::testing::DefaultValue<HRESULT>::Clear(); } 528 static void TearDownTestCase() { ::testing::DefaultValue<HRESULT>::Clear(); }
582 529
583 protected: 530 protected:
584 GoogleUpdateWinTest() 531 GoogleUpdateWinTest()
585 : task_runner_(new base::TestSimpleTaskRunner()), 532 : task_runner_(new base::TestSimpleTaskRunner()),
586 task_runner_handle_(task_runner_), 533 task_runner_handle_(task_runner_),
587 system_level_install_(GetParam()), 534 system_level_install_(GetParam()) {}
588 fake_global_interface_table_(nullptr) {}
589 535
590 void SetUp() override { 536 void SetUp() override {
591 ::testing::TestWithParam<bool>::SetUp(); 537 ::testing::TestWithParam<bool>::SetUp();
592 538
593 // Override FILE_EXE so that it looks like the test is running from the 539 // Override FILE_EXE so that it looks like the test is running from the
594 // standard install location for this mode (system-level or user-level). 540 // standard install location for this mode (system-level or user-level).
595 base::FilePath file_exe; 541 base::FilePath file_exe;
596 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &file_exe)); 542 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &file_exe));
597 base::FilePath install_dir(installer::GetChromeInstallPath( 543 base::FilePath install_dir(installer::GetChromeInstallPath(
598 system_level_install_, BrowserDistribution::GetDistribution())); 544 system_level_install_, BrowserDistribution::GetDistribution()));
(...skipping 30 matching lines...) Expand all
629 ASSERT_EQ(ERROR_SUCCESS, 575 ASSERT_EQ(ERROR_SUCCESS,
630 key.Create(root, kClientState, KEY_WRITE | KEY_WOW64_32KEY)); 576 key.Create(root, kClientState, KEY_WRITE | KEY_WOW64_32KEY));
631 ASSERT_EQ(ERROR_SUCCESS, 577 ASSERT_EQ(ERROR_SUCCESS,
632 key.CreateKey(kChromeGuid, KEY_WRITE | KEY_WOW64_32KEY)); 578 key.CreateKey(kChromeGuid, KEY_WRITE | KEY_WOW64_32KEY));
633 ASSERT_EQ(ERROR_SUCCESS, 579 ASSERT_EQ(ERROR_SUCCESS,
634 key.WriteValue(L"UninstallArguments", 580 key.WriteValue(L"UninstallArguments",
635 L"--uninstall --multi-install --chrome")); 581 L"--uninstall --multi-install --chrome"));
636 582
637 // Provide an IGoogleUpdate3Web class factory so that this test can provide 583 // Provide an IGoogleUpdate3Web class factory so that this test can provide
638 // a mocked-out instance. 584 // a mocked-out instance.
639 SetUpdateCheckFactoriesForTesting( 585 SetGoogleUpdateFactoryForTesting(
640 base::Bind(&GoogleUpdateWinTest::GetFakeGlobalInterfaceTable,
641 base::Unretained(this)),
642 base::Bind(&GoogleUpdateFactory::Create, 586 base::Bind(&GoogleUpdateFactory::Create,
643 base::Unretained(&mock_google_update_factory_))); 587 base::Unretained(&mock_google_update_factory_)));
644 588
645 // Compute a newer version. 589 // Compute a newer version.
646 base::Version current_version(CHROME_VERSION_STRING); 590 base::Version current_version(CHROME_VERSION_STRING);
647 new_version_ = base::StringPrintf(L"%u.%u.%u.%u", 591 new_version_ = base::StringPrintf(L"%u.%u.%u.%u",
648 current_version.components()[0], 592 current_version.components()[0],
649 current_version.components()[1], 593 current_version.components()[1],
650 current_version.components()[2] + 1, 594 current_version.components()[2] + 1,
651 current_version.components()[3]); 595 current_version.components()[3]);
652 } 596 }
653 597
654 // Creates app bundle and app mocks that will be used to simulate Google 598 // Creates app bundle and app mocks that will be used to simulate Google
655 // Update. 599 // Update.
656 void MakeGoogleUpdateMocks(CComObject<MockAppBundle>** mock_app_bundle, 600 void MakeGoogleUpdateMocks(CComObject<MockAppBundle>** mock_app_bundle,
657 CComObject<MockApp>** mock_app) { 601 CComObject<MockApp>** mock_app) {
658 CComObject<MockGoogleUpdate>* google_update = 602 CComObject<MockGoogleUpdate>* google_update =
659 mock_google_update_factory_.MakeServerMock(); 603 mock_google_update_factory_.MakeServerMock();
660 CComObject<MockAppBundle>* app_bundle = google_update->MakeAppBundle(); 604 CComObject<MockAppBundle>* app_bundle = google_update->MakeAppBundle();
661 CComObject<MockApp>* app = app_bundle->MakeApp(kChromeBinariesGuid); 605 CComObject<MockApp>* app = app_bundle->MakeApp(kChromeBinariesGuid);
662 606
663 if (mock_app_bundle) 607 if (mock_app_bundle)
664 *mock_app_bundle = app_bundle; 608 *mock_app_bundle = app_bundle;
665 if (mock_app) 609 if (mock_app)
666 *mock_app = app; 610 *mock_app = app;
667 } 611 }
668 612
669 void TearDown() override { 613 void TearDown() override {
670 // Be sure all objects were removed from the Global Interface Table.
671 if (fake_global_interface_table_) {
672 ASSERT_TRUE(fake_global_interface_table_->empty());
673 global_interface_table_.Release();
674 fake_global_interface_table_ = nullptr;
675 }
676
677 // Remove the test's IGoogleUpdate on-demand update class factory. 614 // Remove the test's IGoogleUpdate on-demand update class factory.
678 SetUpdateCheckFactoriesForTesting(GlobalInterfaceTableClassFactory(), 615 SetGoogleUpdateFactoryForTesting(GoogleUpdate3ClassFactory());
679 GoogleUpdate3ClassFactory());
680 ::testing::TestWithParam<bool>::TearDown(); 616 ::testing::TestWithParam<bool>::TearDown();
681 } 617 }
682 618
683 HRESULT GetFakeGlobalInterfaceTable(
684 base::win::ScopedComPtr<IGlobalInterfaceTable>* global_interface_table) {
685 if (!fake_global_interface_table_) {
686 EXPECT_EQ(S_OK, CComObject<FakeGlobalInterfaceTable>::CreateInstance(
687 &fake_global_interface_table_));
688 EXPECT_NE(nullptr, fake_global_interface_table_);
689 global_interface_table_ = fake_global_interface_table_;
690 }
691 *global_interface_table = global_interface_table_;
692 return S_OK;
693 }
694
695 static const base::char16 kClients[]; 619 static const base::char16 kClients[];
696 static const base::char16 kClientState[]; 620 static const base::char16 kClientState[];
697 static const base::char16 kChromeGuid[]; 621 static const base::char16 kChromeGuid[];
698 static const base::char16 kChromeBinariesGuid[]; 622 static const base::char16 kChromeBinariesGuid[];
699 623
700 base::win::ScopedCOMInitializer com_initializer_;
701 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; 624 scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
702 base::ThreadTaskRunnerHandle task_runner_handle_; 625 base::ThreadTaskRunnerHandle task_runner_handle_;
703 bool system_level_install_; 626 bool system_level_install_;
704 std::unique_ptr<base::ScopedPathOverride> file_exe_override_; 627 std::unique_ptr<base::ScopedPathOverride> file_exe_override_;
705 std::unique_ptr<base::ScopedPathOverride> program_files_override_; 628 std::unique_ptr<base::ScopedPathOverride> program_files_override_;
706 std::unique_ptr<base::ScopedPathOverride> program_files_x86_override_; 629 std::unique_ptr<base::ScopedPathOverride> program_files_x86_override_;
707 std::unique_ptr<base::ScopedPathOverride> local_app_data_override_; 630 std::unique_ptr<base::ScopedPathOverride> local_app_data_override_;
708 registry_util::RegistryOverrideManager registry_override_manager_; 631 registry_util::RegistryOverrideManager registry_override_manager_;
709 632
710 CComObject<FakeGlobalInterfaceTable>* fake_global_interface_table_;
711 base::win::ScopedComPtr<IGlobalInterfaceTable> global_interface_table_;
712
713 // A mock object, the OnUpdateCheckCallback method of which will be invoked 633 // A mock object, the OnUpdateCheckCallback method of which will be invoked
714 // each time the update check machinery invokes the given UpdateCheckCallback. 634 // each time the update check machinery invokes the given UpdateCheckCallback.
715 StrictMock<MockUpdateCheckDelegate> mock_update_check_delegate_; 635 StrictMock<MockUpdateCheckDelegate> mock_update_check_delegate_;
716 636
717 // A mock object that provides a GoogleUpdate3ClassFactory by which the test 637 // A mock object that provides a GoogleUpdate3ClassFactory by which the test
718 // fixture's IGoogleUpdate3Web simulator is provided to the update check 638 // fixture's IGoogleUpdate3Web simulator is provided to the update check
719 // machinery. 639 // machinery.
720 StrictMock<MockGoogleUpdateFactory> mock_google_update_factory_; 640 StrictMock<MockGoogleUpdateFactory> mock_google_update_factory_;
721 641
722 // The new version that the fixture will pretend is available. 642 // The new version that the fixture will pretend is available.
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 } 907 }
988 BeginUpdateCheck(task_runner_, std::string(), true, 0, 908 BeginUpdateCheck(task_runner_, std::string(), true, 0,
989 mock_update_check_delegate_.AsWeakPtr()); 909 mock_update_check_delegate_.AsWeakPtr());
990 task_runner_->RunUntilIdle(); 910 task_runner_->RunUntilIdle();
991 } 911 }
992 912
993 // Test that a retry after a USING_EXTERNAL_UPDATER failure succeeds. 913 // Test that a retry after a USING_EXTERNAL_UPDATER failure succeeds.
994 TEST_P(GoogleUpdateWinTest, RetryAfterExternalUpdaterError) { 914 TEST_P(GoogleUpdateWinTest, RetryAfterExternalUpdaterError) {
995 static const HRESULT GOOPDATE_E_APP_USING_EXTERNAL_UPDATER = 0xa043081d; 915 static const HRESULT GOOPDATE_E_APP_USING_EXTERNAL_UPDATER = 0xa043081d;
996 916
997 CComObject<MockGoogleUpdate>* google_update = 917 CComObject<MockAppBundle>* mock_app_bundle =
998 mock_google_update_factory_.MakeServerMock(); 918 mock_google_update_factory_.MakeServerMock()->MakeAppBundle();
999 CComObject<MockAppBundle>* mock_app_bundle = google_update->MakeAppBundle();
1000 919
1001 // The first attempt will fail in createInstalledApp indicating that an update 920 // The first attempt will fail in createInstalledApp indicating that an update
1002 // is already in progress. 921 // is already in progress.
922 Sequence bundle_seq;
1003 EXPECT_CALL(*mock_app_bundle, createInstalledApp(StrEq(kChromeBinariesGuid))) 923 EXPECT_CALL(*mock_app_bundle, createInstalledApp(StrEq(kChromeBinariesGuid)))
924 .InSequence(bundle_seq)
1004 .WillOnce(Return(GOOPDATE_E_APP_USING_EXTERNAL_UPDATER)); 925 .WillOnce(Return(GOOPDATE_E_APP_USING_EXTERNAL_UPDATER));
1005 926
1006 // Expect a retry on a new bundle. 927 // Expect a retry on the same instance.
1007 mock_app_bundle = google_update->MakeAppBundle(); 928 EXPECT_CALL(*mock_app_bundle, createInstalledApp(StrEq(kChromeBinariesGuid)))
1008 CComObject<MockApp>* mock_app = mock_app_bundle->MakeApp(kChromeBinariesGuid); 929 .InSequence(bundle_seq)
930 .WillOnce(Return(S_OK));
931
932 // See MakeApp() for an explanation of this:
933 CComObject<MockApp>* mock_app = nullptr;
934 EXPECT_EQ(S_OK, CComObject<MockApp>::CreateInstance(&mock_app));
935 mock_app->AddRef();
936 EXPECT_CALL(*mock_app_bundle, get_appWeb(0, _))
937 .WillOnce(DoAll(SetArgPointee<1>(mock_app), Return(S_OK)));
1009 938
1010 // Expect the bundle to be called on to start the update. 939 // Expect the bundle to be called on to start the update.
1011 EXPECT_CALL(*mock_app_bundle, checkForUpdate()).WillOnce(Return(S_OK)); 940 EXPECT_CALL(*mock_app_bundle, checkForUpdate()).WillOnce(Return(S_OK));
1012 941
1013 mock_app->PushState(STATE_INIT); 942 mock_app->PushState(STATE_INIT);
1014 mock_app->PushState(STATE_CHECKING_FOR_UPDATE); 943 mock_app->PushState(STATE_CHECKING_FOR_UPDATE);
1015 mock_app->PushState(STATE_NO_UPDATE); 944 mock_app->PushState(STATE_NO_UPDATE);
1016 945
1017 // Expect the update check to succeed. 946 // Expect the update check to succeed.
1018 EXPECT_CALL(mock_update_check_delegate_, 947 EXPECT_CALL(mock_update_check_delegate_,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 BeginUpdateCheck(task_runner_, std::string(), true, 0, 1009 BeginUpdateCheck(task_runner_, std::string(), true, 0,
1081 mock_update_check_delegate_.AsWeakPtr()); 1010 mock_update_check_delegate_.AsWeakPtr());
1082 BeginUpdateCheck(task_runner_, std::string(), true, 0, 1011 BeginUpdateCheck(task_runner_, std::string(), true, 0,
1083 mock_update_check_delegate_2.AsWeakPtr()); 1012 mock_update_check_delegate_2.AsWeakPtr());
1084 task_runner_->RunUntilIdle(); 1013 task_runner_->RunUntilIdle();
1085 } 1014 }
1086 1015
1087 INSTANTIATE_TEST_CASE_P(UserLevel, GoogleUpdateWinTest, Values(false)); 1016 INSTANTIATE_TEST_CASE_P(UserLevel, GoogleUpdateWinTest, Values(false));
1088 1017
1089 INSTANTIATE_TEST_CASE_P(SystemLevel, GoogleUpdateWinTest, Values(true)); 1018 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