1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef WEBKIT_BROWSER_APPCACHE_APPCACHE_TEST_HELPER_H_ 6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_TEST_HELPER_H_ 7 8 #include <set> 9 10 #include "webkit/browser/appcache/appcache_storage.h" 11 12 namespace appcache { 13 14 class AppCacheService; 15 16 // Helper class for inserting data into a ChromeAppCacheService and reading it 17 // back. 18 class AppCacheTestHelper : public appcache::AppCacheStorage::Delegate { 19 public: 20 AppCacheTestHelper(); 21 virtual ~AppCacheTestHelper(); 22 void AddGroupAndCache(AppCacheService* appcache_service, 23 const GURL& manifest_url); 24 25 void GetOriginsWithCaches(AppCacheService* appcache_service, 26 std::set<GURL>* origins); 27 private: 28 virtual void OnGroupAndNewestCacheStored( 29 appcache::AppCacheGroup* group, 30 appcache::AppCache* newest_cache, 31 bool success, 32 bool would_exceed_quota) OVERRIDE; 33 void OnGotAppCacheInfo(int rv); 34 35 int group_id_; 36 int appcache_id_; 37 int response_id_; 38 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; 39 std::set<GURL>* origins_; // not owned 40 41 DISALLOW_COPY_AND_ASSIGN(AppCacheTestHelper); 42 }; 43 44 } // namespace appcache 45 46 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_TEST_HELPER_H_ 47