| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/test/test_browser_thread_bundle.h" | 55 #include "content/public/test/test_browser_thread_bundle.h" |
| 56 #include "content/public/test/test_utils.h" | 56 #include "content/public/test/test_utils.h" |
| 57 #include "extensions/browser/extension_prefs.h" | 57 #include "extensions/browser/extension_prefs.h" |
| 58 #include "extensions/browser/extension_registry.h" | 58 #include "extensions/browser/extension_registry.h" |
| 59 #include "extensions/browser/extension_system.h" | 59 #include "extensions/browser/extension_system.h" |
| 60 #include "extensions/browser/pref_names.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" |
| 65 #include "extensions/common/constants.h" |
| 64 #include "extensions/common/extension.h" | 66 #include "extensions/common/extension.h" |
| 65 #include "extensions/common/extension_urls.h" | 67 #include "extensions/common/extension_urls.h" |
| 66 #include "extensions/common/manifest_constants.h" | 68 #include "extensions/common/manifest_constants.h" |
| 67 #include "google_apis/gaia/fake_identity_provider.h" | 69 #include "google_apis/gaia/fake_identity_provider.h" |
| 68 #include "google_apis/gaia/fake_oauth2_token_service.h" | 70 #include "google_apis/gaia/fake_oauth2_token_service.h" |
| 69 #include "net/base/backoff_entry.h" | 71 #include "net/base/backoff_entry.h" |
| 70 #include "net/base/escape.h" | 72 #include "net/base/escape.h" |
| 71 #include "net/base/load_flags.h" | 73 #include "net/base/load_flags.h" |
| 72 #include "net/http/http_request_headers.h" | 74 #include "net/http/http_request_headers.h" |
| 73 #include "net/url_request/test_url_fetcher_factory.h" | 75 #include "net/url_request/test_url_fetcher_factory.h" |
| (...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2252 service.GetDownloaderFactory()); | 2254 service.GetDownloaderFactory()); |
| 2253 ExtensionUpdater::CheckParams params; | 2255 ExtensionUpdater::CheckParams params; |
| 2254 params.ids.push_back(id); | 2256 params.ids.push_back(id); |
| 2255 updater.Start(); | 2257 updater.Start(); |
| 2256 updater.CheckNow(params); | 2258 updater.CheckNow(params); |
| 2257 | 2259 |
| 2258 service.set_extensions(ExtensionList(), ExtensionList()); | 2260 service.set_extensions(ExtensionList(), ExtensionList()); |
| 2259 ASSERT_FALSE(service.GetExtensionById(id, false)); | 2261 ASSERT_FALSE(service.GetExtensionById(id, false)); |
| 2260 } | 2262 } |
| 2261 | 2263 |
| 2264 // Tests that we don't get a DCHECK failure when the next check time saved in |
| 2265 // prefs happens to be within one second of startup. |
| 2266 TEST_F(ExtensionUpdaterTest, TestPersistedNextCheckTime) { |
| 2267 base::Time next_check_time = |
| 2268 base::Time::Now() + base::TimeDelta::FromMilliseconds(500); |
| 2269 prefs_->pref_service()->SetInt64(pref_names::kNextUpdateCheck, |
| 2270 next_check_time.ToInternalValue()); |
| 2271 ServiceForManifestTests service(prefs_.get()); |
| 2272 ExtensionUpdater updater(&service, service.extension_prefs(), |
| 2273 service.pref_service(), service.profile(), |
| 2274 kDefaultUpdateFrequencySeconds, nullptr, |
| 2275 service.GetDownloaderFactory()); |
| 2276 updater.Start(); |
| 2277 updater.Stop(); |
| 2278 } |
| 2279 |
| 2262 // TODO(asargent) - (http://crbug.com/12780) add tests for: | 2280 // TODO(asargent) - (http://crbug.com/12780) add tests for: |
| 2263 // -prodversionmin (shouldn't update if browser version too old) | 2281 // -prodversionmin (shouldn't update if browser version too old) |
| 2264 // -manifests & updates arriving out of order / interleaved | 2282 // -manifests & updates arriving out of order / interleaved |
| 2265 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 2283 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
| 2266 // -An extension gets uninstalled while updates are in progress (so it doesn't | 2284 // -An extension gets uninstalled while updates are in progress (so it doesn't |
| 2267 // "come back from the dead") | 2285 // "come back from the dead") |
| 2268 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 2286 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
| 2269 // you don't get downgraded accidentally) | 2287 // you don't get downgraded accidentally) |
| 2270 // -An update manifest mentions multiple updates | 2288 // -An update manifest mentions multiple updates |
| 2271 | 2289 |
| 2272 } // namespace extensions | 2290 } // namespace extensions |
| OLD | NEW |