summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_host_unittest.cc
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 20:26:04 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 20:26:04 +0000
commitf06b43b8bf588d08631f5d3dc196fd9c0e9df3c7 (patch)
treec9ac43bc050ff591959e9ff4fd542bde192c708a /webkit/appcache/appcache_host_unittest.cc
parentdcd23fee75c291fe9b5e7019e3ee31694442ff9e (diff)
downloadchromium_src-f06b43b8bf588d08631f5d3dc196fd9c0e9df3c7.zip
chromium_src-f06b43b8bf588d08631f5d3dc196fd9c0e9df3c7.tar.gz
chromium_src-f06b43b8bf588d08631f5d3dc196fd9c0e9df3c7.tar.bz2
* Fix a bug with the applicationCache.status return value. The wrong status value was visible via applicationCache.status after a swap because we sample GetStatus() before swappable_cache_ was cleared out.
* Pull the plug on support for file:// urls in DEBUG builds for now. TEST=added to appcache_host_unittest.cc BUG=none Review URL: http://codereview.chromium.org/385071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_host_unittest.cc')
-rw-r--r--webkit/appcache/appcache_host_unittest.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/webkit/appcache/appcache_host_unittest.cc b/webkit/appcache/appcache_host_unittest.cc
index 5e36eef..b92443c 100644
--- a/webkit/appcache/appcache_host_unittest.cc
+++ b/webkit/appcache/appcache_host_unittest.cc
@@ -26,7 +26,9 @@ class AppCacheHostTest : public testing::Test {
public:
MockFrontend()
: last_host_id_(-222), last_cache_id_(-222),
- last_status_(appcache::OBSOLETE) {
+ last_status_(appcache::OBSOLETE),
+ last_status_changed_(appcache::OBSOLETE),
+ last_event_id_(appcache::OBSOLETE_EVENT) {
}
virtual void OnCacheSelected(int host_id, int64 cache_id ,
@@ -38,15 +40,19 @@ class AppCacheHostTest : public testing::Test {
virtual void OnStatusChanged(const std::vector<int>& host_ids,
appcache::Status status) {
+ last_status_changed_ = status;
}
virtual void OnEventRaised(const std::vector<int>& host_ids,
appcache::EventID event_id) {
+ last_event_id_ = event_id;
}
int last_host_id_;
int64 last_cache_id_;
appcache::Status last_status_;
+ appcache::Status last_status_changed_;
+ appcache::EventID last_event_id_;
};
void GetStatusCallback(Status status, void* param) {
@@ -153,7 +159,6 @@ TEST_F(AppCacheHostTest, ForeignEntry) {
EXPECT_FALSE(host.is_selection_pending());
}
-
TEST_F(AppCacheHostTest, FailedCacheLoad) {
// Reset our mock frontend
mock_frontend_.last_cache_id_ = -333;
@@ -240,8 +245,15 @@ TEST_F(AppCacheHostTest, SetSwappableCache) {
host.SetSwappableCache(group1);
EXPECT_EQ(cache1, host.swappable_cache_.get());
+ mock_frontend_.last_host_id_ = -222; // to verify we received OnCacheSelected
+
host.AssociateCache(cache1);
EXPECT_FALSE(host.swappable_cache_.get()); // was same as associated cache
+ EXPECT_EQ(appcache::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::IDLE, mock_frontend_.last_status_);
AppCache* cache2 = new AppCache(&service_, 222);
cache2->set_complete(true);