| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authos. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authos. 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "webkit/appcache/appcache.h" | 6 #include "webkit/appcache/appcache.h" |
| 7 #include "webkit/appcache/appcache_group.h" | 7 #include "webkit/appcache/appcache_group.h" |
| 8 #include "webkit/appcache/appcache_host.h" | 8 #include "webkit/appcache/appcache_host.h" |
| 9 #include "webkit/appcache/appcache_service.h" | 9 #include "webkit/appcache/appcache_service.h" |
| 10 #include "webkit/appcache/appcache_update_job.h" |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 class TestAppCacheFrontend : public appcache::AppCacheFrontend { | 14 class TestAppCacheFrontend : public appcache::AppCacheFrontend { |
| 14 public: | 15 public: |
| 15 TestAppCacheFrontend() | 16 TestAppCacheFrontend() |
| 16 : last_host_id_(-1), last_cache_id_(-1), | 17 : last_host_id_(-1), last_cache_id_(-1), |
| 17 last_status_(appcache::OBSOLETE) { | 18 last_status_(appcache::OBSOLETE) { |
| 18 } | 19 } |
| 19 | 20 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 EXPECT_EQ(cache2, group->newest_complete_cache()); | 124 EXPECT_EQ(cache2, group->newest_complete_cache()); |
| 124 | 125 |
| 125 // Unassociate all hosts from older cache. | 126 // Unassociate all hosts from older cache. |
| 126 host1.AssociateCache(NULL); | 127 host1.AssociateCache(NULL); |
| 127 host2.AssociateCache(NULL); | 128 host2.AssociateCache(NULL); |
| 128 EXPECT_EQ(frontend.last_host_id_, host2.host_id()); | 129 EXPECT_EQ(frontend.last_host_id_, host2.host_id()); |
| 129 EXPECT_EQ(frontend.last_cache_id_, appcache::kNoCacheId); | 130 EXPECT_EQ(frontend.last_cache_id_, appcache::kNoCacheId); |
| 130 EXPECT_EQ(frontend.last_status_, appcache::UNCACHED); | 131 EXPECT_EQ(frontend.last_status_, appcache::UNCACHED); |
| 131 } | 132 } |
| 132 | 133 |
| 134 TEST(AppCacheGroupTest, StartUpdate) { |
| 135 /* TODO(jennb) - uncomment after AppCacheGroup::StartUpdate does something. |
| 136 AppCacheService service; |
| 137 scoped_refptr<AppCacheGroup> group = |
| 138 new AppCacheGroup(&service, GURL("http://foo.com")); |
| 139 |
| 140 // Set state to checking to prevent update job from executing fetches. |
| 141 group->update_status_ = AppCacheGroup::CHECKING; |
| 142 group->StartUpdate(); |
| 143 AppCacheUpdateJob* update = group->update_job_; |
| 144 EXPECT_TRUE(update != NULL); |
| 145 |
| 146 // Start another update, check that same update job is in use. |
| 147 group->StartUpdateWithHost(NULL); |
| 148 EXPECT_EQ(update, group->update_job_); |
| 149 |
| 150 // Remove update job's reference to this group. |
| 151 delete update; |
| 152 EXPECT_TRUE(group->update_job_ == NULL); |
| 153 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status()); |
| 154 */ |
| 155 } |
| 156 |
| 133 } // namespace appcache | 157 } // namespace appcache |
| OLD | NEW |