| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 <stdint.h> |
| 6 |
| 5 #include "base/bind.h" | 7 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 7 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 9 #include "content/browser/appcache/appcache.h" | 11 #include "content/browser/appcache/appcache.h" |
| 10 #include "content/browser/appcache/appcache_backend_impl.h" | 12 #include "content/browser/appcache/appcache_backend_impl.h" |
| 11 #include "content/browser/appcache/appcache_group.h" | 13 #include "content/browser/appcache/appcache_group.h" |
| 12 #include "content/browser/appcache/appcache_host.h" | 14 #include "content/browser/appcache/appcache_host.h" |
| 13 #include "content/browser/appcache/mock_appcache_policy.h" | 15 #include "content/browser/appcache/mock_appcache_policy.h" |
| 14 #include "content/browser/appcache/mock_appcache_service.h" | 16 #include "content/browser/appcache/mock_appcache_service.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 74 |
| 73 void OnLogMessage(int host_id, | 75 void OnLogMessage(int host_id, |
| 74 AppCacheLogLevel log_level, | 76 AppCacheLogLevel log_level, |
| 75 const std::string& message) override {} | 77 const std::string& message) override {} |
| 76 | 78 |
| 77 void OnContentBlocked(int host_id, const GURL& manifest_url) override { | 79 void OnContentBlocked(int host_id, const GURL& manifest_url) override { |
| 78 content_blocked_ = true; | 80 content_blocked_ = true; |
| 79 } | 81 } |
| 80 | 82 |
| 81 int last_host_id_; | 83 int last_host_id_; |
| 82 int64 last_cache_id_; | 84 int64_t last_cache_id_; |
| 83 AppCacheStatus last_status_; | 85 AppCacheStatus last_status_; |
| 84 AppCacheStatus last_status_changed_; | 86 AppCacheStatus last_status_changed_; |
| 85 AppCacheEventID last_event_id_; | 87 AppCacheEventID last_event_id_; |
| 86 bool content_blocked_; | 88 bool content_blocked_; |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 class MockQuotaManagerProxy : public storage::QuotaManagerProxy { | 91 class MockQuotaManagerProxy : public storage::QuotaManagerProxy { |
| 90 public: | 92 public: |
| 91 MockQuotaManagerProxy() : QuotaManagerProxy(NULL, NULL) {} | 93 MockQuotaManagerProxy() : QuotaManagerProxy(NULL, NULL) {} |
| 92 | 94 |
| 93 // Not needed for our tests. | 95 // Not needed for our tests. |
| 94 void RegisterClient(storage::QuotaClient* client) override {} | 96 void RegisterClient(storage::QuotaClient* client) override {} |
| 95 void NotifyStorageAccessed(storage::QuotaClient::ID client_id, | 97 void NotifyStorageAccessed(storage::QuotaClient::ID client_id, |
| 96 const GURL& origin, | 98 const GURL& origin, |
| 97 storage::StorageType type) override {} | 99 storage::StorageType type) override {} |
| 98 void NotifyStorageModified(storage::QuotaClient::ID client_id, | 100 void NotifyStorageModified(storage::QuotaClient::ID client_id, |
| 99 const GURL& origin, | 101 const GURL& origin, |
| 100 storage::StorageType type, | 102 storage::StorageType type, |
| 101 int64 delta) override {} | 103 int64_t delta) override {} |
| 102 void SetUsageCacheEnabled(storage::QuotaClient::ID client_id, | 104 void SetUsageCacheEnabled(storage::QuotaClient::ID client_id, |
| 103 const GURL& origin, | 105 const GURL& origin, |
| 104 storage::StorageType type, | 106 storage::StorageType type, |
| 105 bool enabled) override {} | 107 bool enabled) override {} |
| 106 void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner, | 108 void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner, |
| 107 const GURL& origin, | 109 const GURL& origin, |
| 108 storage::StorageType type, | 110 storage::StorageType type, |
| 109 const GetUsageAndQuotaCallback& callback) override {} | 111 const GetUsageAndQuotaCallback& callback) override {} |
| 110 | 112 |
| 111 void NotifyOriginInUse(const GURL& origin) override { inuse_[origin] += 1; } | 113 void NotifyOriginInUse(const GURL& origin) override { inuse_[origin] += 1; } |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 EXPECT_TRUE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); | 539 EXPECT_TRUE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); |
| 538 | 540 |
| 539 // Select methods should bail if cache has already been selected. | 541 // Select methods should bail if cache has already been selected. |
| 540 EXPECT_FALSE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); | 542 EXPECT_FALSE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); |
| 541 EXPECT_FALSE(host.SelectCacheForWorker(0, 0)); | 543 EXPECT_FALSE(host.SelectCacheForWorker(0, 0)); |
| 542 EXPECT_FALSE(host.SelectCacheForSharedWorker(kAppCacheNoCacheId)); | 544 EXPECT_FALSE(host.SelectCacheForSharedWorker(kAppCacheNoCacheId)); |
| 543 EXPECT_FALSE(host.MarkAsForeignEntry(kDocAndOriginUrl, kAppCacheNoCacheId)); | 545 EXPECT_FALSE(host.MarkAsForeignEntry(kDocAndOriginUrl, kAppCacheNoCacheId)); |
| 544 } | 546 } |
| 545 | 547 |
| 546 } // namespace content | 548 } // namespace content |
| OLD | NEW |