| 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 <stack> | 5 #include <stack> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 virtual void OnGroupAndNewestCacheStored( | 200 virtual void OnGroupAndNewestCacheStored( |
| 201 AppCacheGroup* group, AppCache* newest_cache, bool success, | 201 AppCacheGroup* group, AppCache* newest_cache, bool success, |
| 202 bool would_exceed_quota) OVERRIDE { | 202 bool would_exceed_quota) OVERRIDE { |
| 203 stored_group_ = group; | 203 stored_group_ = group; |
| 204 stored_group_success_ = success; | 204 stored_group_success_ = success; |
| 205 would_exceed_quota_ = would_exceed_quota; | 205 would_exceed_quota_ = would_exceed_quota; |
| 206 test_->ScheduleNextTask(); | 206 test_->ScheduleNextTask(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 virtual void OnGroupMadeObsolete(AppCacheGroup* group, | 209 virtual void OnGroupMadeObsolete(AppCacheGroup* group, |
| 210 bool success) OVERRIDE { | 210 bool success, |
| 211 int response_code) OVERRIDE { |
| 211 obsoleted_group_ = group; | 212 obsoleted_group_ = group; |
| 212 obsoleted_success_ = success; | 213 obsoleted_success_ = success; |
| 213 test_->ScheduleNextTask(); | 214 test_->ScheduleNextTask(); |
| 214 } | 215 } |
| 215 | 216 |
| 216 virtual void OnMainResponseFound(const GURL& url, | 217 virtual void OnMainResponseFound(const GURL& url, |
| 217 const AppCacheEntry& entry, | 218 const AppCacheEntry& entry, |
| 218 const GURL& namespace_entry_url, | 219 const GURL& namespace_entry_url, |
| 219 const AppCacheEntry& fallback_entry, | 220 const AppCacheEntry& fallback_entry, |
| 220 int64 cache_id, | 221 int64 cache_id, |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 fallback_namespace_record.namespace_.namespace_url = kFallbackNamespace; | 814 fallback_namespace_record.namespace_.namespace_url = kFallbackNamespace; |
| 814 fallback_namespace_record.origin = kManifestUrl.GetOrigin(); | 815 fallback_namespace_record.origin = kManifestUrl.GetOrigin(); |
| 815 EXPECT_TRUE(database()->InsertNamespace(&fallback_namespace_record)); | 816 EXPECT_TRUE(database()->InsertNamespace(&fallback_namespace_record)); |
| 816 | 817 |
| 817 AppCacheDatabase::OnlineWhiteListRecord online_whitelist_record; | 818 AppCacheDatabase::OnlineWhiteListRecord online_whitelist_record; |
| 818 online_whitelist_record.cache_id = 1; | 819 online_whitelist_record.cache_id = 1; |
| 819 online_whitelist_record.namespace_url = kOnlineNamespace; | 820 online_whitelist_record.namespace_url = kOnlineNamespace; |
| 820 EXPECT_TRUE(database()->InsertOnlineWhiteList(&online_whitelist_record)); | 821 EXPECT_TRUE(database()->InsertOnlineWhiteList(&online_whitelist_record)); |
| 821 | 822 |
| 822 // Conduct the test. | 823 // Conduct the test. |
| 823 storage()->MakeGroupObsolete(group_.get(), delegate()); | 824 storage()->MakeGroupObsolete(group_.get(), delegate(), 0); |
| 824 EXPECT_FALSE(group_->is_obsolete()); | 825 EXPECT_FALSE(group_->is_obsolete()); |
| 825 } | 826 } |
| 826 | 827 |
| 827 void Verify_MakeGroupObsolete() { | 828 void Verify_MakeGroupObsolete() { |
| 828 EXPECT_TRUE(delegate()->obsoleted_success_); | 829 EXPECT_TRUE(delegate()->obsoleted_success_); |
| 829 EXPECT_EQ(group_.get(), delegate()->obsoleted_group_.get()); | 830 EXPECT_EQ(group_.get(), delegate()->obsoleted_group_.get()); |
| 830 EXPECT_TRUE(group_->is_obsolete()); | 831 EXPECT_TRUE(group_->is_obsolete()); |
| 831 EXPECT_TRUE(storage()->usage_map_.empty()); | 832 EXPECT_TRUE(storage()->usage_map_.empty()); |
| 832 | 833 |
| 833 // The cache and group have been deleted from the database. | 834 // The cache and group have been deleted from the database. |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 int host_id, const appcache::AppCacheInfo& info) OVERRIDE {} | 1601 int host_id, const appcache::AppCacheInfo& info) OVERRIDE {} |
| 1601 virtual void OnStatusChanged(const std::vector<int>& host_ids, | 1602 virtual void OnStatusChanged(const std::vector<int>& host_ids, |
| 1602 Status status) OVERRIDE {} | 1603 Status status) OVERRIDE {} |
| 1603 virtual void OnEventRaised(const std::vector<int>& host_ids, | 1604 virtual void OnEventRaised(const std::vector<int>& host_ids, |
| 1604 EventID event_id) OVERRIDE {} | 1605 EventID event_id) OVERRIDE {} |
| 1605 virtual void OnProgressEventRaised( | 1606 virtual void OnProgressEventRaised( |
| 1606 const std::vector<int>& host_ids, | 1607 const std::vector<int>& host_ids, |
| 1607 const GURL& url, | 1608 const GURL& url, |
| 1608 int num_total, int num_complete) OVERRIDE {} | 1609 int num_total, int num_complete) OVERRIDE {} |
| 1609 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, | 1610 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, |
| 1610 const std::string& message) OVERRIDE { | 1611 const appcache::ErrorDetails& details) |
| 1612 OVERRIDE { |
| 1611 error_event_was_raised_ = true; | 1613 error_event_was_raised_ = true; |
| 1612 } | 1614 } |
| 1613 virtual void OnLogMessage(int host_id, LogLevel log_level, | 1615 virtual void OnLogMessage(int host_id, LogLevel log_level, |
| 1614 const std::string& message) OVERRIDE {} | 1616 const std::string& message) OVERRIDE {} |
| 1615 virtual void OnContentBlocked( | 1617 virtual void OnContentBlocked( |
| 1616 int host_id, const GURL& manifest_url) OVERRIDE {} | 1618 int host_id, const GURL& manifest_url) OVERRIDE {} |
| 1617 | 1619 |
| 1618 bool error_event_was_raised_; | 1620 bool error_event_was_raised_; |
| 1619 }; | 1621 }; |
| 1620 | 1622 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); | 2002 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); |
| 2001 } | 2003 } |
| 2002 | 2004 |
| 2003 TEST_F(AppCacheStorageImplTest, Reinitialize3) { | 2005 TEST_F(AppCacheStorageImplTest, Reinitialize3) { |
| 2004 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); | 2006 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); |
| 2005 } | 2007 } |
| 2006 | 2008 |
| 2007 // That's all folks! | 2009 // That's all folks! |
| 2008 | 2010 |
| 2009 } // namespace appcache | 2011 } // namespace appcache |
| OLD | NEW |