| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "content/browser/appcache/mock_appcache_service.h" | 8 #include "content/browser/appcache/mock_appcache_service.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "webkit/browser/appcache/appcache.h" | 10 #include "webkit/browser/appcache/appcache.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual void OnCacheSelected( | 32 virtual void OnCacheSelected( |
| 33 int host_id, const appcache::AppCacheInfo& info) OVERRIDE { | 33 int host_id, const appcache::AppCacheInfo& info) OVERRIDE { |
| 34 last_host_id_ = host_id; | 34 last_host_id_ = host_id; |
| 35 last_cache_id_ = info.cache_id; | 35 last_cache_id_ = info.cache_id; |
| 36 last_status_ = info.status; | 36 last_status_ = info.status; |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void OnStatusChanged(const std::vector<int>& host_ids, | 39 virtual void OnStatusChanged(const std::vector<int>& host_ids, |
| 40 appcache::Status status) OVERRIDE { | 40 appcache::AppCacheStatus status) OVERRIDE { |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual void OnEventRaised(const std::vector<int>& host_ids, | 43 virtual void OnEventRaised(const std::vector<int>& host_ids, |
| 44 appcache::EventID event_id) OVERRIDE { | 44 appcache::AppCacheEventID event_id) OVERRIDE { |
| 45 } | 45 } |
| 46 | 46 |
| 47 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, | 47 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, |
| 48 const appcache::ErrorDetails& details) | 48 const appcache::AppCacheErrorDetails& details) |
| 49 OVERRIDE {} | 49 OVERRIDE {} |
| 50 | 50 |
| 51 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, | 51 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, |
| 52 const GURL& url, | 52 const GURL& url, |
| 53 int num_total, int num_complete) OVERRIDE { | 53 int num_total, int num_complete) OVERRIDE { |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual void OnLogMessage(int host_id, appcache::LogLevel log_level, | 56 virtual void OnLogMessage(int host_id, appcache::AppCacheLogLevel log_level, |
| 57 const std::string& message) OVERRIDE { | 57 const std::string& message) OVERRIDE { |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void OnContentBlocked(int host_id, | 60 virtual void OnContentBlocked(int host_id, |
| 61 const GURL& manifest_url) OVERRIDE { | 61 const GURL& manifest_url) OVERRIDE { |
| 62 } | 62 } |
| 63 | 63 |
| 64 int last_host_id_; | 64 int last_host_id_; |
| 65 int64 last_cache_id_; | 65 int64 last_cache_id_; |
| 66 appcache::Status last_status_; | 66 appcache::AppCacheStatus last_status_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace anon | 69 } // namespace anon |
| 70 | 70 |
| 71 namespace content { | 71 namespace content { |
| 72 | 72 |
| 73 class TestUpdateObserver : public AppCacheGroup::UpdateObserver { | 73 class TestUpdateObserver : public AppCacheGroup::UpdateObserver { |
| 74 public: | 74 public: |
| 75 TestUpdateObserver() : update_completed_(false), group_has_cache_(false) { | 75 TestUpdateObserver() : update_completed_(false), group_has_cache_(false) { |
| 76 } | 76 } |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 EXPECT_TRUE(group->FindObserver(&host, group->observers_)); | 300 EXPECT_TRUE(group->FindObserver(&host, group->observers_)); |
| 301 | 301 |
| 302 // Delete update to cause it to complete. Verify host is notified. | 302 // Delete update to cause it to complete. Verify host is notified. |
| 303 delete group->update_job_; | 303 delete group->update_job_; |
| 304 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); | 304 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); |
| 305 EXPECT_TRUE(group->restart_update_task_.IsCancelled()); | 305 EXPECT_TRUE(group->restart_update_task_.IsCancelled()); |
| 306 EXPECT_TRUE(host.update_completed_); | 306 EXPECT_TRUE(host.update_completed_); |
| 307 } | 307 } |
| 308 | 308 |
| 309 } // namespace content | 309 } // namespace content |
| OLD | NEW |