OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef WEBKIT_APPCACHE_APPCACHE_TEST_HELPER_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_TEST_HELPER_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_TEST_HELPER_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_TEST_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "net/base/completion_callback.h" | |
12 #include "webkit/appcache/appcache_storage.h" | 11 #include "webkit/appcache/appcache_storage.h" |
13 | 12 |
14 namespace appcache { | 13 namespace appcache { |
15 | 14 |
16 class AppCacheService; | 15 class AppCacheService; |
17 | 16 |
18 // Helper class for inserting data into a ChromeAppCacheService and reading it | 17 // Helper class for inserting data into a ChromeAppCacheService and reading it |
19 // back. | 18 // back. |
20 class AppCacheTestHelper : public appcache::AppCacheStorage::Delegate { | 19 class AppCacheTestHelper : public appcache::AppCacheStorage::Delegate { |
21 public: | 20 public: |
22 AppCacheTestHelper(); | 21 AppCacheTestHelper(); |
23 virtual ~AppCacheTestHelper(); | 22 virtual ~AppCacheTestHelper(); |
24 void AddGroupAndCache(AppCacheService* appcache_service, | 23 void AddGroupAndCache(AppCacheService* appcache_service, |
25 const GURL& manifest_url); | 24 const GURL& manifest_url); |
26 | 25 |
27 void GetOriginsWithCaches(AppCacheService* appcache_service, | 26 void GetOriginsWithCaches(AppCacheService* appcache_service, |
28 std::set<GURL>* origins); | 27 std::set<GURL>* origins); |
29 private: | 28 private: |
30 virtual void OnGroupAndNewestCacheStored( | 29 virtual void OnGroupAndNewestCacheStored( |
31 appcache::AppCacheGroup* group, | 30 appcache::AppCacheGroup* group, |
32 appcache::AppCache* newest_cache, | 31 appcache::AppCache* newest_cache, |
33 bool success, | 32 bool success, |
34 bool would_exceed_quota) OVERRIDE; | 33 bool would_exceed_quota) OVERRIDE; |
35 void OnGotAppCacheInfo(int rv); | 34 void OnGotAppCacheInfo(int rv); |
36 | 35 |
37 int group_id_; | 36 int group_id_; |
38 int appcache_id_; | 37 int appcache_id_; |
39 int response_id_; | 38 int response_id_; |
40 net::OldCompletionCallbackImpl<AppCacheTestHelper> appcache_got_info_callback_
; | |
41 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; | 39 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; |
42 std::set<GURL>* origins_; // not owned | 40 std::set<GURL>* origins_; // not owned |
43 | 41 |
44 DISALLOW_COPY_AND_ASSIGN(AppCacheTestHelper); | 42 DISALLOW_COPY_AND_ASSIGN(AppCacheTestHelper); |
45 }; | 43 }; |
46 | 44 |
47 } // namespace appcache | 45 } // namespace appcache |
48 | 46 |
49 #endif // WEBKIT_APPCACHE_APPCACHE_TEST_HELPER_H_ | 47 #endif // WEBKIT_APPCACHE_APPCACHE_TEST_HELPER_H_ |
OLD | NEW |