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> |
| 6 |
5 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "webkit/appcache/appcache.h" | 8 #include "webkit/appcache/appcache.h" |
7 #include "webkit/appcache/appcache_group.h" | 9 #include "webkit/appcache/appcache_group.h" |
8 #include "webkit/appcache/appcache_host.h" | 10 #include "webkit/appcache/appcache_host.h" |
9 #include "webkit/appcache/mock_appcache_service.h" | 11 #include "webkit/appcache/mock_appcache_service.h" |
10 #include "webkit/appcache/appcache_update_job.h" | 12 #include "webkit/appcache/appcache_update_job.h" |
| 13 #include "webkit/appcache/appcache_interfaces.h" |
11 | 14 |
12 namespace { | 15 namespace { |
13 | 16 |
14 class TestAppCacheFrontend : public appcache::AppCacheFrontend { | 17 class TestAppCacheFrontend : public appcache::AppCacheFrontend { |
15 public: | 18 public: |
16 TestAppCacheFrontend() | 19 TestAppCacheFrontend() |
17 : last_host_id_(-1), last_cache_id_(-1), | 20 : last_host_id_(-1), last_cache_id_(-1), |
18 last_status_(appcache::OBSOLETE) { | 21 last_status_(appcache::OBSOLETE) { |
19 } | 22 } |
20 | 23 |
21 virtual void OnCacheSelected(int host_id, int64 cache_id , | 24 virtual void OnCacheSelected( |
22 appcache::Status status) { | 25 int host_id, const appcache::AppCacheInfo& info) { |
23 last_host_id_ = host_id; | 26 last_host_id_ = host_id; |
24 last_cache_id_ = cache_id; | 27 last_cache_id_ = info.cache_id; |
25 last_status_ = status; | 28 last_status_ = info.status; |
26 } | 29 } |
27 | 30 |
28 virtual void OnStatusChanged(const std::vector<int>& host_ids, | 31 virtual void OnStatusChanged(const std::vector<int>& host_ids, |
29 appcache::Status status) { | 32 appcache::Status status) { |
30 } | 33 } |
31 | 34 |
32 virtual void OnEventRaised(const std::vector<int>& host_ids, | 35 virtual void OnEventRaised(const std::vector<int>& host_ids, |
33 appcache::EventID event_id) { | 36 appcache::EventID event_id) { |
34 } | 37 } |
35 | 38 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 EXPECT_TRUE(group->FindObserver(&host, group->observers_)); | 289 EXPECT_TRUE(group->FindObserver(&host, group->observers_)); |
287 | 290 |
288 // Delete update to cause it to complete. Verify host is notified. | 291 // Delete update to cause it to complete. Verify host is notified. |
289 delete group->update_job_; | 292 delete group->update_job_; |
290 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); | 293 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); |
291 EXPECT_FALSE(group->restart_update_task_); | 294 EXPECT_FALSE(group->restart_update_task_); |
292 EXPECT_TRUE(host.update_completed_); | 295 EXPECT_TRUE(host.update_completed_); |
293 } | 296 } |
294 | 297 |
295 } // namespace appcache | 298 } // namespace appcache |
OLD | NEW |