| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "net/url_request/url_request.h" | 8 #include "net/url_request/url_request.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "webkit/appcache/appcache.h" | 10 #include "webkit/appcache/appcache.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 mock_frontend_.last_host_id_ = -333; | 247 mock_frontend_.last_host_id_ = -333; |
| 248 mock_frontend_.last_status_ = OBSOLETE; | 248 mock_frontend_.last_status_ = OBSOLETE; |
| 249 | 249 |
| 250 // Precondition, a cache with a fallback entry that is not marked as foreign. | 250 // Precondition, a cache with a fallback entry that is not marked as foreign. |
| 251 const int kCacheId = 22; | 251 const int kCacheId = 22; |
| 252 const GURL kFallbackURL("http://origin/fallback_resource"); | 252 const GURL kFallbackURL("http://origin/fallback_resource"); |
| 253 scoped_refptr<AppCache> cache = new AppCache(&service_, kCacheId); | 253 scoped_refptr<AppCache> cache = new AppCache(&service_, kCacheId); |
| 254 cache->AddEntry(kFallbackURL, AppCacheEntry(AppCacheEntry::FALLBACK)); | 254 cache->AddEntry(kFallbackURL, AppCacheEntry(AppCacheEntry::FALLBACK)); |
| 255 | 255 |
| 256 AppCacheHost host(1, &mock_frontend_, &service_); | 256 AppCacheHost host(1, &mock_frontend_, &service_); |
| 257 host.NotifyMainResourceFallback(kFallbackURL); | 257 host.NotifyMainResourceIsNamespaceEntry(kFallbackURL); |
| 258 host.MarkAsForeignEntry(GURL("http://origin/missing_document"), kCacheId); | 258 host.MarkAsForeignEntry(GURL("http://origin/missing_document"), kCacheId); |
| 259 | 259 |
| 260 // We should have received an OnCacheSelected msg for kNoCacheId. | 260 // We should have received an OnCacheSelected msg for kNoCacheId. |
| 261 EXPECT_EQ(1, mock_frontend_.last_host_id_); | 261 EXPECT_EQ(1, mock_frontend_.last_host_id_); |
| 262 EXPECT_EQ(kNoCacheId, mock_frontend_.last_cache_id_); | 262 EXPECT_EQ(kNoCacheId, mock_frontend_.last_cache_id_); |
| 263 EXPECT_EQ(UNCACHED, mock_frontend_.last_status_); | 263 EXPECT_EQ(UNCACHED, mock_frontend_.last_status_); |
| 264 | 264 |
| 265 // See that the fallback entry was marked as foreign. | 265 // See that the fallback entry was marked as foreign. |
| 266 EXPECT_TRUE(cache->GetEntry(kFallbackURL)->IsForeign()); | 266 EXPECT_TRUE(cache->GetEntry(kFallbackURL)->IsForeign()); |
| 267 } | 267 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 EXPECT_EQ(&mock_frontend_, host.frontend()); | 512 EXPECT_EQ(&mock_frontend_, host.frontend()); |
| 513 EXPECT_EQ(NULL, host.associated_cache()); | 513 EXPECT_EQ(NULL, host.associated_cache()); |
| 514 EXPECT_FALSE(host.is_selection_pending()); | 514 EXPECT_FALSE(host.is_selection_pending()); |
| 515 EXPECT_TRUE(host.preferred_manifest_url().is_empty()); | 515 EXPECT_TRUE(host.preferred_manifest_url().is_empty()); |
| 516 } | 516 } |
| 517 EXPECT_EQ(0, mock_quota_proxy->GetInUseCount(kDocAndOriginUrl)); | 517 EXPECT_EQ(0, mock_quota_proxy->GetInUseCount(kDocAndOriginUrl)); |
| 518 service_.set_quota_manager_proxy(NULL); | 518 service_.set_quota_manager_proxy(NULL); |
| 519 } | 519 } |
| 520 | 520 |
| 521 } // namespace appcache | 521 } // namespace appcache |
| OLD | NEW |