#include "base/bind_helpers.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "content/browser/appcache/appcache.h"
+#include "content/browser/appcache/appcache_backend_impl.h"
+#include "content/browser/appcache/appcache_group.h"
+#include "content/browser/appcache/appcache_host.h"
#include "content/browser/appcache/mock_appcache_policy.h"
#include "content/browser/appcache/mock_appcache_service.h"
#include "net/url_request/url_request.h"
+#include "storage/browser/quota/quota_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/browser/appcache/appcache.h"
-#include "webkit/browser/appcache/appcache_backend_impl.h"
-#include "webkit/browser/appcache/appcache_group.h"
-#include "webkit/browser/appcache/appcache_host.h"
-#include "webkit/browser/quota/quota_manager.h"
-
-using appcache::AppCache;
-using appcache::AppCacheBackendImpl;
-using appcache::AppCacheEntry;
-using appcache::AppCacheFrontend;
-using appcache::AppCacheGroup;
-using appcache::AppCacheHost;
-using appcache::kAppCacheNoCacheId;
-using appcache::APPCACHE_ERROR_EVENT;
-using appcache::APPCACHE_STATUS_OBSOLETE;
-using appcache::APPCACHE_OBSOLETE_EVENT;
-using appcache::APPCACHE_PROGRESS_EVENT;
-using appcache::AppCacheStatus;
-using appcache::APPCACHE_STATUS_UNCACHED;
namespace content {
public:
MockFrontend()
: last_host_id_(-222), last_cache_id_(-222),
- last_status_(appcache::APPCACHE_STATUS_OBSOLETE),
- last_status_changed_(appcache::APPCACHE_STATUS_OBSOLETE),
- last_event_id_(appcache::APPCACHE_OBSOLETE_EVENT),
+ last_status_(APPCACHE_STATUS_OBSOLETE),
+ last_status_changed_(APPCACHE_STATUS_OBSOLETE),
+ last_event_id_(APPCACHE_OBSOLETE_EVENT),
content_blocked_(false) {
}
virtual void OnCacheSelected(
- int host_id, const appcache::AppCacheInfo& info) OVERRIDE {
+ int host_id, const AppCacheInfo& info) OVERRIDE {
last_host_id_ = host_id;
last_cache_id_ = info.cache_id;
last_status_ = info.status;
}
virtual void OnStatusChanged(const std::vector<int>& host_ids,
- appcache::AppCacheStatus status) OVERRIDE {
+ AppCacheStatus status) OVERRIDE {
last_status_changed_ = status;
}
virtual void OnEventRaised(const std::vector<int>& host_ids,
- appcache::AppCacheEventID event_id) OVERRIDE {
+ AppCacheEventID event_id) OVERRIDE {
last_event_id_ = event_id;
}
virtual void OnErrorEventRaised(
const std::vector<int>& host_ids,
- const appcache::AppCacheErrorDetails& details) OVERRIDE {
+ const AppCacheErrorDetails& details) OVERRIDE {
last_event_id_ = APPCACHE_ERROR_EVENT;
}
}
virtual void OnLogMessage(int host_id,
- appcache::AppCacheLogLevel log_level,
+ AppCacheLogLevel log_level,
const std::string& message) OVERRIDE {
}
int last_host_id_;
int64 last_cache_id_;
- appcache::AppCacheStatus last_status_;
- appcache::AppCacheStatus last_status_changed_;
- appcache::AppCacheEventID last_event_id_;
+ AppCacheStatus last_status_;
+ AppCacheStatus last_status_changed_;
+ AppCacheEventID last_event_id_;
bool content_blocked_;
};
- class MockQuotaManagerProxy : public quota::QuotaManagerProxy {
+ class MockQuotaManagerProxy : public storage::QuotaManagerProxy {
public:
MockQuotaManagerProxy() : QuotaManagerProxy(NULL, NULL) {}
// Not needed for our tests.
- virtual void RegisterClient(quota::QuotaClient* client) OVERRIDE {}
- virtual void NotifyStorageAccessed(quota::QuotaClient::ID client_id,
+ virtual void RegisterClient(storage::QuotaClient* client) OVERRIDE {}
+ virtual void NotifyStorageAccessed(storage::QuotaClient::ID client_id,
const GURL& origin,
- quota::StorageType type) OVERRIDE {}
- virtual void NotifyStorageModified(quota::QuotaClient::ID client_id,
+ storage::StorageType type) OVERRIDE {}
+ virtual void NotifyStorageModified(storage::QuotaClient::ID client_id,
const GURL& origin,
- quota::StorageType type,
+ storage::StorageType type,
int64 delta) OVERRIDE {}
- virtual void SetUsageCacheEnabled(quota::QuotaClient::ID client_id,
+ virtual void SetUsageCacheEnabled(storage::QuotaClient::ID client_id,
const GURL& origin,
- quota::StorageType type,
+ storage::StorageType type,
bool enabled) OVERRIDE {}
virtual void GetUsageAndQuota(
base::SequencedTaskRunner* original_task_runner,
const GURL& origin,
- quota::StorageType type,
+ storage::StorageType type,
const GetUsageAndQuotaCallback& callback) OVERRIDE {}
virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {
MockFrontend mock_frontend_;
// Mock callbacks we expect to receive from the 'host'
- appcache::GetStatusCallback get_status_callback_;
- appcache::StartUpdateCallback start_update_callback_;
- appcache::SwapCacheCallback swap_cache_callback_;
+ content::GetStatusCallback get_status_callback_;
+ content::StartUpdateCallback start_update_callback_;
+ content::SwapCacheCallback swap_cache_callback_;
AppCacheStatus last_status_result_;
bool last_swap_result_;
host.AssociateCompleteCache(cache1);
EXPECT_FALSE(host.swappable_cache_.get()); // was same as associated cache
- EXPECT_EQ(appcache::APPCACHE_STATUS_IDLE, host.GetStatus());
+ EXPECT_EQ(APPCACHE_STATUS_IDLE, host.GetStatus());
// verify OnCacheSelected was called
EXPECT_EQ(host.host_id(), mock_frontend_.last_host_id_);
EXPECT_EQ(cache1->cache_id(), mock_frontend_.last_cache_id_);
- EXPECT_EQ(appcache::APPCACHE_STATUS_IDLE, mock_frontend_.last_status_);
+ EXPECT_EQ(APPCACHE_STATUS_IDLE, mock_frontend_.last_status_);
AppCache* cache2 = new AppCache(service_.storage(), 222);
cache2->set_complete(true);