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

Side by Side Diff: chrome/browser/extensions/updater/extension_updater_unittest.cc

Issue 2163883005: WIP: Obtain Bootstrap from utility process Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 (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/browser/extensions/updater/extension_updater.h" 5 #include "chrome/browser/extensions/updater/extension_updater.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "chrome/test/base/testing_browser_process.h" 45 #include "chrome/test/base/testing_browser_process.h"
46 #include "chrome/test/base/testing_profile.h" 46 #include "chrome/test/base/testing_profile.h"
47 #include "components/crx_file/id_util.h" 47 #include "components/crx_file/id_util.h"
48 #include "components/syncable_prefs/pref_service_syncable.h" 48 #include "components/syncable_prefs/pref_service_syncable.h"
49 #include "components/update_client/update_query_params.h" 49 #include "components/update_client/update_query_params.h"
50 #include "content/public/browser/notification_details.h" 50 #include "content/public/browser/notification_details.h"
51 #include "content/public/browser/notification_observer.h" 51 #include "content/public/browser/notification_observer.h"
52 #include "content/public/browser/notification_registrar.h" 52 #include "content/public/browser/notification_registrar.h"
53 #include "content/public/browser/notification_service.h" 53 #include "content/public/browser/notification_service.h"
54 #include "content/public/browser/notification_source.h" 54 #include "content/public/browser/notification_source.h"
55 #include "content/public/browser/service_manager_context.h"
55 #include "content/public/test/test_browser_thread_bundle.h" 56 #include "content/public/test/test_browser_thread_bundle.h"
56 #include "content/public/test/test_utils.h" 57 #include "content/public/test/test_utils.h"
57 #include "extensions/browser/extension_prefs.h" 58 #include "extensions/browser/extension_prefs.h"
58 #include "extensions/browser/extension_registry.h" 59 #include "extensions/browser/extension_registry.h"
59 #include "extensions/browser/extension_system.h" 60 #include "extensions/browser/extension_system.h"
60 #include "extensions/browser/updater/extension_downloader.h" 61 #include "extensions/browser/updater/extension_downloader.h"
61 #include "extensions/browser/updater/extension_downloader_delegate.h" 62 #include "extensions/browser/updater/extension_downloader_delegate.h"
62 #include "extensions/browser/updater/manifest_fetch_data.h" 63 #include "extensions/browser/updater/manifest_fetch_data.h"
63 #include "extensions/browser/updater/request_queue_impl.h" 64 #include "extensions/browser/updater/request_queue_impl.h"
64 #include "extensions/common/extension.h" 65 #include "extensions/common/extension.h"
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 // inside this class (which is a friend to ExtensionUpdater). 644 // inside this class (which is a friend to ExtensionUpdater).
644 class ExtensionUpdaterTest : public testing::Test { 645 class ExtensionUpdaterTest : public testing::Test {
645 public: 646 public:
646 ExtensionUpdaterTest() 647 ExtensionUpdaterTest()
647 : thread_bundle_( 648 : thread_bundle_(
648 content::TestBrowserThreadBundle::IO_MAINLOOP), 649 content::TestBrowserThreadBundle::IO_MAINLOOP),
649 testing_local_state_(TestingBrowserProcess::GetGlobal()) { 650 testing_local_state_(TestingBrowserProcess::GetGlobal()) {
650 } 651 }
651 652
652 void SetUp() override { 653 void SetUp() override {
654 service_manager_context_ = content::ServiceManagerContext::Create();
653 prefs_.reset(new TestExtensionPrefs(base::ThreadTaskRunnerHandle::Get())); 655 prefs_.reset(new TestExtensionPrefs(base::ThreadTaskRunnerHandle::Get()));
654 } 656 }
655 657
656 void TearDown() override { 658 void TearDown() override {
657 // Some tests create URLRequestContextGetters, whose destruction must run 659 // Some tests create URLRequestContextGetters, whose destruction must run
658 // on the IO thread. Make sure the IO loop spins before shutdown so that 660 // on the IO thread. Make sure the IO loop spins before shutdown so that
659 // those objects are released. 661 // those objects are released.
660 RunUntilIdle(); 662 RunUntilIdle();
661 prefs_.reset(); 663 prefs_.reset();
662 } 664 }
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 ManifestFetchData* CreateManifestFetchData(const GURL& update_url) { 1893 ManifestFetchData* CreateManifestFetchData(const GURL& update_url) {
1892 return new ManifestFetchData(update_url, 0, "", 1894 return new ManifestFetchData(update_url, 0, "",
1893 UpdateQueryParams::Get(UpdateQueryParams::CRX), 1895 UpdateQueryParams::Get(UpdateQueryParams::CRX),
1894 ManifestFetchData::PING); 1896 ManifestFetchData::PING);
1895 } 1897 }
1896 1898
1897 private: 1899 private:
1898 content::TestBrowserThreadBundle thread_bundle_; 1900 content::TestBrowserThreadBundle thread_bundle_;
1899 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; 1901 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_;
1900 ScopedTestingLocalState testing_local_state_; 1902 ScopedTestingLocalState testing_local_state_;
1903 std::unique_ptr<content::ServiceManagerContext> service_manager_context_;
1901 1904
1902 #if defined OS_CHROMEOS 1905 #if defined OS_CHROMEOS
1903 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 1906 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
1904 chromeos::ScopedTestCrosSettings test_cros_settings_; 1907 chromeos::ScopedTestCrosSettings test_cros_settings_;
1905 chromeos::ScopedTestUserManager test_user_manager_; 1908 chromeos::ScopedTestUserManager test_user_manager_;
1906 #endif 1909 #endif
1907 }; 1910 };
1908 1911
1909 // Because we test some private methods of ExtensionUpdater, it's easier for the 1912 // Because we test some private methods of ExtensionUpdater, it's easier for the
1910 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F 1913 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 // -prodversionmin (shouldn't update if browser version too old) 2265 // -prodversionmin (shouldn't update if browser version too old)
2263 // -manifests & updates arriving out of order / interleaved 2266 // -manifests & updates arriving out of order / interleaved
2264 // -malformed update url (empty, file://, has query, has a # fragment, etc.) 2267 // -malformed update url (empty, file://, has query, has a # fragment, etc.)
2265 // -An extension gets uninstalled while updates are in progress (so it doesn't 2268 // -An extension gets uninstalled while updates are in progress (so it doesn't
2266 // "come back from the dead") 2269 // "come back from the dead")
2267 // -An extension gets manually updated to v3 while we're downloading v2 (ie 2270 // -An extension gets manually updated to v3 while we're downloading v2 (ie
2268 // you don't get downgraded accidentally) 2271 // you don't get downgraded accidentally)
2269 // -An update manifest mentions multiple updates 2272 // -An update manifest mentions multiple updates
2270 2273
2271 } // namespace extensions 2274 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698