| Index: webkit/appcache/appcache_storage_impl_unittest.cc
|
| diff --git a/webkit/appcache/appcache_storage_impl_unittest.cc b/webkit/appcache/appcache_storage_impl_unittest.cc
|
| index 0b914f7e54990156618333dbc4614d3c3eda4fd8..1b2b5ffe6b87d5cb1294f170542fa9c25cd03d39 100644
|
| --- a/webkit/appcache/appcache_storage_impl_unittest.cc
|
| +++ b/webkit/appcache/appcache_storage_impl_unittest.cc
|
| @@ -13,7 +13,6 @@
|
| #include "webkit/appcache/appcache_database.h"
|
| #include "webkit/appcache/appcache_entry.h"
|
| #include "webkit/appcache/appcache_group.h"
|
| -#include "webkit/appcache/appcache_policy.h"
|
| #include "webkit/appcache/appcache_service.h"
|
| #include "webkit/appcache/appcache_storage_impl.h"
|
| #include "webkit/quota/quota_manager.h"
|
| @@ -88,8 +87,7 @@ class AppCacheStorageImplTest : public testing::Test {
|
| explicit MockStorageDelegate(AppCacheStorageImplTest* test)
|
| : loaded_cache_id_(0), stored_group_success_(false),
|
| would_exceed_quota_(false), obsoleted_success_(false),
|
| - found_cache_id_(kNoCacheId), found_blocked_by_policy_(false),
|
| - test_(test) {
|
| + found_cache_id_(kNoCacheId), test_(test) {
|
| }
|
|
|
| void OnCacheLoaded(AppCache* cache, int64 cache_id) {
|
| @@ -124,15 +122,13 @@ class AppCacheStorageImplTest : public testing::Test {
|
| void OnMainResponseFound(const GURL& url, const AppCacheEntry& entry,
|
| const GURL& fallback_url,
|
| const AppCacheEntry& fallback_entry,
|
| - int64 cache_id, const GURL& manifest_url,
|
| - bool was_blocked_by_policy) {
|
| + int64 cache_id, const GURL& manifest_url) {
|
| found_url_ = url;
|
| found_entry_ = entry;
|
| found_fallback_url_ = fallback_url;
|
| found_fallback_entry_ = fallback_entry;
|
| found_cache_id_ = cache_id;
|
| found_manifest_url_ = manifest_url;
|
| - found_blocked_by_policy_ = was_blocked_by_policy;
|
| test_->ScheduleNextTask();
|
| }
|
|
|
| @@ -152,35 +148,6 @@ class AppCacheStorageImplTest : public testing::Test {
|
| AppCacheEntry found_fallback_entry_;
|
| int64 found_cache_id_;
|
| GURL found_manifest_url_;
|
| - bool found_blocked_by_policy_;
|
| - AppCacheStorageImplTest* test_;
|
| - };
|
| -
|
| - class MockAppCachePolicy : public AppCachePolicy {
|
| - public:
|
| - explicit MockAppCachePolicy(AppCacheStorageImplTest* test)
|
| - : can_load_return_value_(true), can_create_return_value_(0),
|
| - callback_(NULL), test_(test) {
|
| - }
|
| -
|
| - virtual bool CanLoadAppCache(const GURL& manifest_url) {
|
| - requested_manifest_url_ = manifest_url;
|
| - return can_load_return_value_;
|
| - }
|
| -
|
| - virtual int CanCreateAppCache(const GURL& manifest_url,
|
| - net::CompletionCallback* callback) {
|
| - requested_manifest_url_ = manifest_url;
|
| - callback_ = callback;
|
| - if (can_create_return_value_ == net::ERR_IO_PENDING)
|
| - test_->ScheduleNextTask();
|
| - return can_create_return_value_;
|
| - }
|
| -
|
| - bool can_load_return_value_;
|
| - int can_create_return_value_;
|
| - GURL requested_manifest_url_;
|
| - net::CompletionCallback* callback_;
|
| AppCacheStorageImplTest* test_;
|
| };
|
|
|
| @@ -309,8 +276,7 @@ class AppCacheStorageImplTest : public testing::Test {
|
|
|
| // Test harness --------------------------------------------------
|
|
|
| - AppCacheStorageImplTest()
|
| - : ALLOW_THIS_IN_INITIALIZER_LIST(policy_(this)) {
|
| + AppCacheStorageImplTest() {
|
| }
|
|
|
| template <class Method>
|
| @@ -870,9 +836,7 @@ class AppCacheStorageImplTest : public testing::Test {
|
|
|
| void Verify_FindNoMainResponse() {
|
| EXPECT_EQ(kEntryUrl, delegate()->found_url_);
|
| - // If the request was blocked by a policy, the manifest url is still valid.
|
| - EXPECT_TRUE(delegate()->found_manifest_url_.is_empty() ||
|
| - delegate()->found_blocked_by_policy_);
|
| + EXPECT_TRUE(delegate()->found_manifest_url_.is_empty());
|
| EXPECT_EQ(kNoCacheId, delegate()->found_cache_id_);
|
| EXPECT_EQ(kNoResponseId, delegate()->found_entry_.response_id());
|
| EXPECT_EQ(kNoResponseId, delegate()->found_fallback_entry_.response_id());
|
| @@ -885,25 +849,17 @@ class AppCacheStorageImplTest : public testing::Test {
|
| // BasicFindMainResponse -------------------------------
|
|
|
| void BasicFindMainResponseInDatabase() {
|
| - BasicFindMainResponse(true, false);
|
| + BasicFindMainResponse(true);
|
| }
|
|
|
| void BasicFindMainResponseInWorkingSet() {
|
| - BasicFindMainResponse(false, false);
|
| - }
|
| -
|
| - void BlockFindMainResponseWithPolicyCheck() {
|
| - BasicFindMainResponse(true, true);
|
| + BasicFindMainResponse(false);
|
| }
|
|
|
| - void BasicFindMainResponse(bool drop_from_working_set,
|
| - bool block_with_policy_check) {
|
| + void BasicFindMainResponse(bool drop_from_working_set) {
|
| PushNextTask(NewRunnableMethod(
|
| this, &AppCacheStorageImplTest::Verify_BasicFindMainResponse));
|
|
|
| - policy_.can_load_return_value_ = !block_with_policy_check;
|
| - service()->set_appcache_policy(&policy_);
|
| -
|
| // Setup some preconditions. Create a complete cache with an entry
|
| // in storage.
|
| MakeCacheAndGroup(kManifestUrl, 1, 1, true);
|
| @@ -929,19 +885,13 @@ class AppCacheStorageImplTest : public testing::Test {
|
| }
|
|
|
| void Verify_BasicFindMainResponse() {
|
| - EXPECT_EQ(kManifestUrl, policy_.requested_manifest_url_);
|
| - if (policy_.can_load_return_value_) {
|
| - EXPECT_EQ(kEntryUrl, delegate()->found_url_);
|
| - EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_);
|
| - EXPECT_FALSE(delegate()->found_blocked_by_policy_);
|
| - EXPECT_EQ(1, delegate()->found_cache_id_);
|
| - EXPECT_EQ(1, delegate()->found_entry_.response_id());
|
| - EXPECT_TRUE(delegate()->found_entry_.IsExplicit());
|
| - EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id());
|
| - TestFinished();
|
| - } else {
|
| - Verify_FindNoMainResponse();
|
| - }
|
| + EXPECT_EQ(kEntryUrl, delegate()->found_url_);
|
| + EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_);
|
| + EXPECT_EQ(1, delegate()->found_cache_id_);
|
| + EXPECT_EQ(1, delegate()->found_entry_.response_id());
|
| + EXPECT_TRUE(delegate()->found_entry_.IsExplicit());
|
| + EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id());
|
| + TestFinished();
|
| }
|
|
|
| // BasicFindMainFallbackResponse -------------------------------
|
| @@ -1001,7 +951,6 @@ class AppCacheStorageImplTest : public testing::Test {
|
| void Verify_BasicFindMainFallbackResponse() {
|
| EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_);
|
| EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_);
|
| - EXPECT_FALSE(delegate()->found_blocked_by_policy_);
|
| EXPECT_EQ(1, delegate()->found_cache_id_);
|
| EXPECT_FALSE(delegate()->found_entry_.has_response_id());
|
| EXPECT_EQ(2, delegate()->found_fallback_entry_.response_id());
|
| @@ -1076,7 +1025,6 @@ class AppCacheStorageImplTest : public testing::Test {
|
| void Verify_FindMainResponseWithMultipleHits() {
|
| EXPECT_EQ(kEntryUrl, delegate()->found_url_);
|
| EXPECT_EQ(kManifestUrl3, delegate()->found_manifest_url_);
|
| - EXPECT_FALSE(delegate()->found_blocked_by_policy_);
|
| EXPECT_EQ(3, delegate()->found_cache_id_);
|
| EXPECT_EQ(3, delegate()->found_entry_.response_id());
|
| EXPECT_TRUE(delegate()->found_entry_.IsExplicit());
|
| @@ -1093,7 +1041,6 @@ class AppCacheStorageImplTest : public testing::Test {
|
| void Verify_FindMainResponseWithMultipleHits2() {
|
| EXPECT_EQ(kEntryUrl, delegate()->found_url_);
|
| EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_);
|
| - EXPECT_FALSE(delegate()->found_blocked_by_policy_);
|
| EXPECT_EQ(1, delegate()->found_cache_id_);
|
| EXPECT_EQ(1, delegate()->found_entry_.response_id());
|
| EXPECT_TRUE(delegate()->found_entry_.IsExplicit());
|
| @@ -1110,7 +1057,6 @@ class AppCacheStorageImplTest : public testing::Test {
|
| void Verify_FindMainResponseWithMultipleHits3() {
|
| EXPECT_EQ(kEntryUrl, delegate()->found_url_);
|
| EXPECT_EQ(kManifestUrl2, delegate()->found_manifest_url_);
|
| - EXPECT_FALSE(delegate()->found_blocked_by_policy_);
|
| EXPECT_EQ(2, delegate()->found_cache_id_);
|
| EXPECT_EQ(2, delegate()->found_entry_.response_id());
|
| EXPECT_TRUE(delegate()->found_entry_.IsExplicit());
|
| @@ -1128,7 +1074,6 @@ class AppCacheStorageImplTest : public testing::Test {
|
| void Verify_FindMainResponseWithMultipleHits4() {
|
| EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_);
|
| EXPECT_EQ(kManifestUrl3, delegate()->found_manifest_url_);
|
| - EXPECT_FALSE(delegate()->found_blocked_by_policy_);
|
| EXPECT_EQ(3, delegate()->found_cache_id_);
|
| EXPECT_FALSE(delegate()->found_entry_.has_response_id());
|
| EXPECT_EQ(3 + kFallbackEntryIdOffset,
|
| @@ -1148,7 +1093,6 @@ class AppCacheStorageImplTest : public testing::Test {
|
| void Verify_FindMainResponseWithMultipleHits5() {
|
| EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_);
|
| EXPECT_EQ(kManifestUrl2, delegate()->found_manifest_url_);
|
| - EXPECT_FALSE(delegate()->found_blocked_by_policy_);
|
| EXPECT_EQ(2, delegate()->found_cache_id_);
|
| EXPECT_FALSE(delegate()->found_entry_.has_response_id());
|
| EXPECT_EQ(2 + kFallbackEntryIdOffset,
|
| @@ -1219,7 +1163,6 @@ class AppCacheStorageImplTest : public testing::Test {
|
| void Verify_ExclusionNotFound(GURL expected_url, int phase) {
|
| EXPECT_EQ(expected_url, delegate()->found_url_);
|
| EXPECT_TRUE(delegate()->found_manifest_url_.is_empty());
|
| - EXPECT_FALSE(delegate()->found_blocked_by_policy_);
|
| EXPECT_EQ(kNoCacheId, delegate()->found_cache_id_);
|
| EXPECT_EQ(kNoResponseId, delegate()->found_entry_.response_id());
|
| EXPECT_EQ(kNoResponseId, delegate()->found_fallback_entry_.response_id());
|
| @@ -1309,7 +1252,6 @@ class AppCacheStorageImplTest : public testing::Test {
|
|
|
| scoped_ptr<base::WaitableEvent> test_finished_event_;
|
| std::stack<Task*> task_stack_;
|
| - MockAppCachePolicy policy_;
|
| scoped_ptr<AppCacheService> service_;
|
| scoped_ptr<MockStorageDelegate> delegate_;
|
| scoped_refptr<MockQuotaManagerProxy> mock_quota_manager_proxy_;
|
| @@ -1382,11 +1324,6 @@ TEST_F(AppCacheStorageImplTest, BasicFindMainResponseInWorkingSet) {
|
| &AppCacheStorageImplTest::BasicFindMainResponseInWorkingSet);
|
| }
|
|
|
| -TEST_F(AppCacheStorageImplTest, BlockFindMainResponseWithPolicyCheck) {
|
| - RunTestOnIOThread(
|
| - &AppCacheStorageImplTest::BlockFindMainResponseWithPolicyCheck);
|
| -}
|
| -
|
| TEST_F(AppCacheStorageImplTest, BasicFindMainFallbackResponseInDatabase) {
|
| RunTestOnIOThread(
|
| &AppCacheStorageImplTest::BasicFindMainFallbackResponseInDatabase);
|
|
|