OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "webkit/appcache/appcache.h" | 8 #include "webkit/appcache/appcache.h" |
9 #include "webkit/appcache/appcache_group.h" | 9 #include "webkit/appcache/appcache_group.h" |
10 #include "webkit/appcache/appcache_host.h" | 10 #include "webkit/appcache/appcache_host.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 EXPECT_FALSE(group->queued_updates_.empty()); | 268 EXPECT_FALSE(group->queued_updates_.empty()); |
269 | 269 |
270 group->AddUpdateObserver(&host); | 270 group->AddUpdateObserver(&host); |
271 EXPECT_FALSE(group->FindObserver(&host, group->observers_)); | 271 EXPECT_FALSE(group->FindObserver(&host, group->observers_)); |
272 EXPECT_TRUE(group->FindObserver(&host, group->queued_observers_)); | 272 EXPECT_TRUE(group->FindObserver(&host, group->queued_observers_)); |
273 | 273 |
274 // Delete update to cause it to complete. Verify no update complete notice | 274 // Delete update to cause it to complete. Verify no update complete notice |
275 // sent to host. | 275 // sent to host. |
276 delete group->update_job_; | 276 delete group->update_job_; |
277 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); | 277 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); |
278 EXPECT_TRUE(group->restart_update_task_); | 278 EXPECT_FALSE(group->restart_update_task_.IsCancelled()); |
279 EXPECT_FALSE(host.update_completed_); | 279 EXPECT_FALSE(host.update_completed_); |
280 | 280 |
281 // Start another update. Cancels task and will run queued updates. | 281 // Start another update. Cancels task and will run queued updates. |
282 group->update_status_ = AppCacheGroup::CHECKING; // prevent actual fetches | 282 group->update_status_ = AppCacheGroup::CHECKING; // prevent actual fetches |
283 group->StartUpdate(); | 283 group->StartUpdate(); |
284 EXPECT_TRUE(group->update_job_); | 284 EXPECT_TRUE(group->update_job_); |
285 EXPECT_FALSE(group->restart_update_task_); | 285 EXPECT_TRUE(group->restart_update_task_.IsCancelled()); |
286 EXPECT_TRUE(group->queued_updates_.empty()); | 286 EXPECT_TRUE(group->queued_updates_.empty()); |
287 EXPECT_FALSE(group->update_job_->pending_master_entries_.empty()); | 287 EXPECT_FALSE(group->update_job_->pending_master_entries_.empty()); |
288 EXPECT_FALSE(group->FindObserver(&host, group->queued_observers_)); | 288 EXPECT_FALSE(group->FindObserver(&host, group->queued_observers_)); |
289 EXPECT_TRUE(group->FindObserver(&host, group->observers_)); | 289 EXPECT_TRUE(group->FindObserver(&host, group->observers_)); |
290 | 290 |
291 // Delete update to cause it to complete. Verify host is notified. | 291 // Delete update to cause it to complete. Verify host is notified. |
292 delete group->update_job_; | 292 delete group->update_job_; |
293 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); | 293 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); |
294 EXPECT_FALSE(group->restart_update_task_); | 294 EXPECT_TRUE(group->restart_update_task_.IsCancelled()); |
295 EXPECT_TRUE(host.update_completed_); | 295 EXPECT_TRUE(host.update_completed_); |
296 } | 296 } |
297 | 297 |
298 } // namespace appcache | 298 } // namespace appcache |
OLD | NEW |