OLD | NEW |
1 // Copyright (c) 2009 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 "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/mock_appcache_service.h" | 9 #include "webkit/appcache/mock_appcache_service.h" |
10 #include "webkit/appcache/appcache_update_job.h" | 10 #include "webkit/appcache/appcache_update_job.h" |
11 | 11 |
(...skipping 14 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 virtual void OnStatusChanged(const std::vector<int>& host_ids, | 28 virtual void OnStatusChanged(const std::vector<int>& host_ids, |
29 appcache::Status status) { | 29 appcache::Status status) { |
30 } | 30 } |
31 | 31 |
32 virtual void OnEventRaised(const std::vector<int>& host_ids, | 32 virtual void OnEventRaised(const std::vector<int>& host_ids, |
33 appcache::EventID event_id) { | 33 appcache::EventID event_id) { |
34 } | 34 } |
35 | 35 |
| 36 virtual void OnContentBlocked(int host_id) { |
| 37 } |
| 38 |
36 int last_host_id_; | 39 int last_host_id_; |
37 int64 last_cache_id_; | 40 int64 last_cache_id_; |
38 appcache::Status last_status_; | 41 appcache::Status last_status_; |
39 }; | 42 }; |
40 | 43 |
41 } // namespace anon | 44 } // namespace anon |
42 | 45 |
43 namespace appcache { | 46 namespace appcache { |
44 | 47 |
45 class TestUpdateObserver : public AppCacheGroup::UpdateObserver { | 48 class TestUpdateObserver : public AppCacheGroup::UpdateObserver { |
46 public: | 49 public: |
47 TestUpdateObserver() : update_completed_(false), group_has_cache_(false) { | 50 TestUpdateObserver() : update_completed_(false), group_has_cache_(false) { |
48 } | 51 } |
49 | 52 |
50 virtual void OnUpdateComplete(AppCacheGroup* group) { | 53 virtual void OnUpdateComplete(AppCacheGroup* group) { |
51 update_completed_ = true; | 54 update_completed_ = true; |
52 group_has_cache_ = group->HasCache(); | 55 group_has_cache_ = group->HasCache(); |
53 } | 56 } |
54 | 57 |
| 58 virtual void OnContentBlocked(AppCacheGroup* group) { |
| 59 } |
| 60 |
55 bool update_completed_; | 61 bool update_completed_; |
56 bool group_has_cache_; | 62 bool group_has_cache_; |
57 }; | 63 }; |
58 | 64 |
59 class TestAppCacheHost : public AppCacheHost { | 65 class TestAppCacheHost : public AppCacheHost { |
60 public: | 66 public: |
61 TestAppCacheHost(int host_id, AppCacheFrontend* frontend, | 67 TestAppCacheHost(int host_id, AppCacheFrontend* frontend, |
62 AppCacheService* service) | 68 AppCacheService* service) |
63 : AppCacheHost(host_id, frontend, service), | 69 : AppCacheHost(host_id, frontend, service), |
64 update_completed_(false) { | 70 update_completed_(false) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 EXPECT_TRUE(group->FindObserver(&host, group->observers_)); | 272 EXPECT_TRUE(group->FindObserver(&host, group->observers_)); |
267 | 273 |
268 // Delete update to cause it to complete. Verify host is notified. | 274 // Delete update to cause it to complete. Verify host is notified. |
269 delete group->update_job_; | 275 delete group->update_job_; |
270 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); | 276 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); |
271 EXPECT_FALSE(group->restart_update_task_); | 277 EXPECT_FALSE(group->restart_update_task_); |
272 EXPECT_TRUE(host.update_completed_); | 278 EXPECT_TRUE(host.update_completed_); |
273 } | 279 } |
274 | 280 |
275 } // namespace appcache | 281 } // namespace appcache |
OLD | NEW |