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

Unified Diff: components/browsing_data/content/storage_partition_http_cache_data_remover.cc

Issue 2768883002: Change MockBrowsingDataRemover to MockBrowsingDataRemoverDelegate (Closed)
Patch Set: Fixed the comment. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_content_browser_client_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browsing_data/content/storage_partition_http_cache_data_remover.cc
diff --git a/components/browsing_data/content/storage_partition_http_cache_data_remover.cc b/components/browsing_data/content/storage_partition_http_cache_data_remover.cc
index 5eeff79f1ecb2ceb9dbaae2872f6d8fde8efa9e9..ffcbbea7ee4846fef7b79b0b962cbfa741fd09e4 100644
--- a/components/browsing_data/content/storage_partition_http_cache_data_remover.cc
+++ b/components/browsing_data/content/storage_partition_http_cache_data_remover.cc
@@ -83,8 +83,6 @@ void StoragePartitionHttpCacheDataRemover::ClearHttpCacheOnIOThread() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
next_cache_state_ = CacheState::NONE;
DCHECK_EQ(CacheState::NONE, next_cache_state_);
- DCHECK(main_context_getter_.get());
- DCHECK(media_context_getter_.get());
next_cache_state_ = CacheState::CREATE_MAIN;
DoClearCache(net::OK);
@@ -97,8 +95,8 @@ void StoragePartitionHttpCacheDataRemover::ClearedHttpCache() {
}
// The expected state sequence is CacheState::NONE --> CacheState::CREATE_MAIN
-// --> CacheState::PROCESS_MAIN --> CacheState::CREATE_MEDIA -->
-// CacheState::PROCESS_MEDIA --> CacheState::DONE, and any errors are ignored.
+// --> CacheState::DELETE_MAIN --> CacheState::CREATE_MEDIA -->
+// CacheState::DELETE_MEDIA --> CacheState::DONE, and any errors are ignored.
void StoragePartitionHttpCacheDataRemover::DoClearCache(int rv) {
DCHECK_NE(CacheState::NONE, next_cache_state_);
@@ -111,6 +109,15 @@ void StoragePartitionHttpCacheDataRemover::DoClearCache(int rv) {
(next_cache_state_ == CacheState::CREATE_MAIN)
? main_context_getter_.get()
: media_context_getter_.get();
+
+ // Caches might not exist in tests.
+ if (!getter) {
+ next_cache_state_ = (next_cache_state_ == CacheState::CREATE_MAIN)
+ ? CacheState::CREATE_MEDIA
+ : CacheState::DONE;
+ break;
+ }
+
net::HttpCache* http_cache = getter->GetURLRequestContext()
->http_transaction_factory()
->GetCache();
« no previous file with comments | « chrome/browser/chrome_content_browser_client_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698