Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / browser / appcache / mock_appcache_service.h
1 // Copyright 2014 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 CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_SERVICE_H_
6 #define CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_SERVICE_H_
7
8 #include "base/compiler_specific.h"
9 #include "content/browser/appcache/mock_appcache_storage.h"
10 #include "webkit/browser/appcache/appcache_service.h"
11 #include "webkit/browser/quota/quota_manager.h"
12
13 using appcache::AppCacheService;
14
15 namespace content {
16
17 // For use by unit tests.
18 class MockAppCacheService : public AppCacheService {
19  public:
20   MockAppCacheService()
21     : AppCacheService(NULL),
22       mock_delete_appcaches_for_origin_result_(net::OK),
23       delete_called_count_(0) {
24     storage_.reset(new MockAppCacheStorage(this));
25   }
26
27   // Just returns a canned completion code without actually
28   // removing groups and caches in our mock storage instance.
29   virtual void DeleteAppCachesForOrigin(
30       const GURL& origin,
31       const net::CompletionCallback& callback) OVERRIDE;
32
33   void set_quota_manager_proxy(quota::QuotaManagerProxy* proxy) {
34     quota_manager_proxy_ = proxy;
35   }
36
37   void set_mock_delete_appcaches_for_origin_result(int rv) {
38     mock_delete_appcaches_for_origin_result_ = rv;
39   }
40
41   int delete_called_count() const { return delete_called_count_; }
42
43  private:
44   int mock_delete_appcaches_for_origin_result_;
45   int delete_called_count_;
46 };
47
48 }  // namespace content
49
50 #endif  // CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_SERVICE_H_