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/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 Loading... |
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/shell_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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 // inside this class (which is a friend to ExtensionUpdater). | 643 // inside this class (which is a friend to ExtensionUpdater). |
643 class ExtensionUpdaterTest : public testing::Test { | 644 class ExtensionUpdaterTest : public testing::Test { |
644 public: | 645 public: |
645 ExtensionUpdaterTest() | 646 ExtensionUpdaterTest() |
646 : thread_bundle_( | 647 : thread_bundle_( |
647 content::TestBrowserThreadBundle::IO_MAINLOOP), | 648 content::TestBrowserThreadBundle::IO_MAINLOOP), |
648 testing_local_state_(TestingBrowserProcess::GetGlobal()) { | 649 testing_local_state_(TestingBrowserProcess::GetGlobal()) { |
649 } | 650 } |
650 | 651 |
651 void SetUp() override { | 652 void SetUp() override { |
| 653 shell_context_ = content::ShellContext::Create(); |
652 prefs_.reset(new TestExtensionPrefs(base::ThreadTaskRunnerHandle::Get())); | 654 prefs_.reset(new TestExtensionPrefs(base::ThreadTaskRunnerHandle::Get())); |
653 } | 655 } |
654 | 656 |
655 void TearDown() override { | 657 void TearDown() override { |
656 // Some tests create URLRequestContextGetters, whose destruction must run | 658 // Some tests create URLRequestContextGetters, whose destruction must run |
657 // on the IO thread. Make sure the IO loop spins before shutdown so that | 659 // on the IO thread. Make sure the IO loop spins before shutdown so that |
658 // those objects are released. | 660 // those objects are released. |
659 RunUntilIdle(); | 661 RunUntilIdle(); |
660 prefs_.reset(); | 662 prefs_.reset(); |
661 } | 663 } |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 ManifestFetchData* CreateManifestFetchData(const GURL& update_url) { | 1891 ManifestFetchData* CreateManifestFetchData(const GURL& update_url) { |
1890 return new ManifestFetchData(update_url, 0, "", | 1892 return new ManifestFetchData(update_url, 0, "", |
1891 UpdateQueryParams::Get(UpdateQueryParams::CRX), | 1893 UpdateQueryParams::Get(UpdateQueryParams::CRX), |
1892 ManifestFetchData::PING); | 1894 ManifestFetchData::PING); |
1893 } | 1895 } |
1894 | 1896 |
1895 private: | 1897 private: |
1896 content::TestBrowserThreadBundle thread_bundle_; | 1898 content::TestBrowserThreadBundle thread_bundle_; |
1897 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; | 1899 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; |
1898 ScopedTestingLocalState testing_local_state_; | 1900 ScopedTestingLocalState testing_local_state_; |
| 1901 std::unique_ptr<content::ShellContext> shell_context_; |
1899 | 1902 |
1900 #if defined OS_CHROMEOS | 1903 #if defined OS_CHROMEOS |
1901 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 1904 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
1902 chromeos::ScopedTestCrosSettings test_cros_settings_; | 1905 chromeos::ScopedTestCrosSettings test_cros_settings_; |
1903 chromeos::ScopedTestUserManager test_user_manager_; | 1906 chromeos::ScopedTestUserManager test_user_manager_; |
1904 #endif | 1907 #endif |
1905 }; | 1908 }; |
1906 | 1909 |
1907 // Because we test some private methods of ExtensionUpdater, it's easier for the | 1910 // Because we test some private methods of ExtensionUpdater, it's easier for the |
1908 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F | 1911 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 // -prodversionmin (shouldn't update if browser version too old) | 2263 // -prodversionmin (shouldn't update if browser version too old) |
2261 // -manifests & updates arriving out of order / interleaved | 2264 // -manifests & updates arriving out of order / interleaved |
2262 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 2265 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
2263 // -An extension gets uninstalled while updates are in progress (so it doesn't | 2266 // -An extension gets uninstalled while updates are in progress (so it doesn't |
2264 // "come back from the dead") | 2267 // "come back from the dead") |
2265 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 2268 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
2266 // you don't get downgraded accidentally) | 2269 // you don't get downgraded accidentally) |
2267 // -An update manifest mentions multiple updates | 2270 // -An update manifest mentions multiple updates |
2268 | 2271 |
2269 } // namespace extensions | 2272 } // namespace extensions |
OLD | NEW |