summaryrefslogtreecommitdiffstats
path: root/content/test/appcache_test_helper.h
blob: 4ac283a3485d9976c9bc782dad8ead256b35ae76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_TEST_APPCACHE_TEST_HELPER_H_
#define CONTENT_TEST_APPCACHE_TEST_HELPER_H_

#include <set>

#include "base/macros.h"
#include "content/browser/appcache/appcache_storage.h"

namespace content {
class AppCacheServiceImpl;
}

namespace content {

// Helper class for inserting data into a ChromeAppCacheService and reading it
// back.
class AppCacheTestHelper : public AppCacheStorage::Delegate {
 public:
  AppCacheTestHelper();
  ~AppCacheTestHelper() override;
  void AddGroupAndCache(AppCacheServiceImpl* appcache_service,
                        const GURL& manifest_url);

  void GetOriginsWithCaches(AppCacheServiceImpl* appcache_service,
                            std::set<GURL>* origins);
 private:
  void OnGroupAndNewestCacheStored(AppCacheGroup* group,
                                   AppCache* newest_cache,
                                   bool success,
                                   bool would_exceed_quota) override;
  void OnGotAppCacheInfo(int rv);

  int group_id_;
  int appcache_id_;
  int response_id_;
  scoped_refptr<AppCacheInfoCollection> appcache_info_;
  std::set<GURL>* origins_;  // not owned

  DISALLOW_COPY_AND_ASSIGN(AppCacheTestHelper);
};

}  // namespace content

#endif  // CONTENT_TEST_APPCACHE_TEST_HELPER_H_