Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: content/browser/appcache/appcache_host_unittest.cc

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/browser/appcache/appcache.h" 9 #include "content/browser/appcache/appcache.h"
10 #include "content/browser/appcache/appcache_backend_impl.h" 10 #include "content/browser/appcache/appcache_backend_impl.h"
(...skipping 24 matching lines...) Expand all
35 class MockFrontend : public AppCacheFrontend { 35 class MockFrontend : public AppCacheFrontend {
36 public: 36 public:
37 MockFrontend() 37 MockFrontend()
38 : last_host_id_(-222), last_cache_id_(-222), 38 : last_host_id_(-222), last_cache_id_(-222),
39 last_status_(APPCACHE_STATUS_OBSOLETE), 39 last_status_(APPCACHE_STATUS_OBSOLETE),
40 last_status_changed_(APPCACHE_STATUS_OBSOLETE), 40 last_status_changed_(APPCACHE_STATUS_OBSOLETE),
41 last_event_id_(APPCACHE_OBSOLETE_EVENT), 41 last_event_id_(APPCACHE_OBSOLETE_EVENT),
42 content_blocked_(false) { 42 content_blocked_(false) {
43 } 43 }
44 44
45 virtual void OnCacheSelected( 45 void OnCacheSelected(int host_id, const AppCacheInfo& info) override {
46 int host_id, const AppCacheInfo& info) override {
47 last_host_id_ = host_id; 46 last_host_id_ = host_id;
48 last_cache_id_ = info.cache_id; 47 last_cache_id_ = info.cache_id;
49 last_status_ = info.status; 48 last_status_ = info.status;
50 } 49 }
51 50
52 virtual void OnStatusChanged(const std::vector<int>& host_ids, 51 void OnStatusChanged(const std::vector<int>& host_ids,
53 AppCacheStatus status) override { 52 AppCacheStatus status) override {
54 last_status_changed_ = status; 53 last_status_changed_ = status;
55 } 54 }
56 55
57 virtual void OnEventRaised(const std::vector<int>& host_ids, 56 void OnEventRaised(const std::vector<int>& host_ids,
58 AppCacheEventID event_id) override { 57 AppCacheEventID event_id) override {
59 last_event_id_ = event_id; 58 last_event_id_ = event_id;
60 } 59 }
61 60
62 virtual void OnErrorEventRaised( 61 void OnErrorEventRaised(const std::vector<int>& host_ids,
63 const std::vector<int>& host_ids, 62 const AppCacheErrorDetails& details) override {
64 const AppCacheErrorDetails& details) override {
65 last_event_id_ = APPCACHE_ERROR_EVENT; 63 last_event_id_ = APPCACHE_ERROR_EVENT;
66 } 64 }
67 65
68 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, 66 void OnProgressEventRaised(const std::vector<int>& host_ids,
69 const GURL& url, 67 const GURL& url,
70 int num_total, 68 int num_total,
71 int num_complete) override { 69 int num_complete) override {
72 last_event_id_ = APPCACHE_PROGRESS_EVENT; 70 last_event_id_ = APPCACHE_PROGRESS_EVENT;
73 } 71 }
74 72
75 virtual void OnLogMessage(int host_id, 73 void OnLogMessage(int host_id,
76 AppCacheLogLevel log_level, 74 AppCacheLogLevel log_level,
77 const std::string& message) override { 75 const std::string& message) override {}
78 }
79 76
80 virtual void OnContentBlocked(int host_id, 77 void OnContentBlocked(int host_id, const GURL& manifest_url) override {
81 const GURL& manifest_url) override {
82 content_blocked_ = true; 78 content_blocked_ = true;
83 } 79 }
84 80
85 int last_host_id_; 81 int last_host_id_;
86 int64 last_cache_id_; 82 int64 last_cache_id_;
87 AppCacheStatus last_status_; 83 AppCacheStatus last_status_;
88 AppCacheStatus last_status_changed_; 84 AppCacheStatus last_status_changed_;
89 AppCacheEventID last_event_id_; 85 AppCacheEventID last_event_id_;
90 bool content_blocked_; 86 bool content_blocked_;
91 }; 87 };
92 88
93 class MockQuotaManagerProxy : public storage::QuotaManagerProxy { 89 class MockQuotaManagerProxy : public storage::QuotaManagerProxy {
94 public: 90 public:
95 MockQuotaManagerProxy() : QuotaManagerProxy(NULL, NULL) {} 91 MockQuotaManagerProxy() : QuotaManagerProxy(NULL, NULL) {}
96 92
97 // Not needed for our tests. 93 // Not needed for our tests.
98 virtual void RegisterClient(storage::QuotaClient* client) override {} 94 void RegisterClient(storage::QuotaClient* client) override {}
99 virtual void NotifyStorageAccessed(storage::QuotaClient::ID client_id, 95 void NotifyStorageAccessed(storage::QuotaClient::ID client_id,
100 const GURL& origin, 96 const GURL& origin,
101 storage::StorageType type) override {} 97 storage::StorageType type) override {}
102 virtual void NotifyStorageModified(storage::QuotaClient::ID client_id, 98 void NotifyStorageModified(storage::QuotaClient::ID client_id,
103 const GURL& origin, 99 const GURL& origin,
104 storage::StorageType type, 100 storage::StorageType type,
105 int64 delta) override {} 101 int64 delta) override {}
106 virtual void SetUsageCacheEnabled(storage::QuotaClient::ID client_id, 102 void SetUsageCacheEnabled(storage::QuotaClient::ID client_id,
107 const GURL& origin, 103 const GURL& origin,
108 storage::StorageType type, 104 storage::StorageType type,
109 bool enabled) override {} 105 bool enabled) override {}
110 virtual void GetUsageAndQuota( 106 void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner,
111 base::SequencedTaskRunner* original_task_runner, 107 const GURL& origin,
112 const GURL& origin, 108 storage::StorageType type,
113 storage::StorageType type, 109 const GetUsageAndQuotaCallback& callback) override {}
114 const GetUsageAndQuotaCallback& callback) override {}
115 110
116 virtual void NotifyOriginInUse(const GURL& origin) override { 111 void NotifyOriginInUse(const GURL& origin) override { inuse_[origin] += 1; }
117 inuse_[origin] += 1;
118 }
119 112
120 virtual void NotifyOriginNoLongerInUse(const GURL& origin) override { 113 void NotifyOriginNoLongerInUse(const GURL& origin) override {
121 inuse_[origin] -= 1; 114 inuse_[origin] -= 1;
122 } 115 }
123 116
124 int GetInUseCount(const GURL& origin) { 117 int GetInUseCount(const GURL& origin) {
125 return inuse_[origin]; 118 return inuse_[origin];
126 } 119 }
127 120
128 void reset() { 121 void reset() {
129 inuse_.clear(); 122 inuse_.clear();
130 } 123 }
131 124
132 // Map from origin to count of inuse notifications. 125 // Map from origin to count of inuse notifications.
133 std::map<GURL, int> inuse_; 126 std::map<GURL, int> inuse_;
134 127
135 protected: 128 protected:
136 virtual ~MockQuotaManagerProxy() {} 129 ~MockQuotaManagerProxy() override {}
137 }; 130 };
138 131
139 void GetStatusCallback(AppCacheStatus status, void* param) { 132 void GetStatusCallback(AppCacheStatus status, void* param) {
140 last_status_result_ = status; 133 last_status_result_ = status;
141 last_callback_param_ = param; 134 last_callback_param_ = param;
142 } 135 }
143 136
144 void StartUpdateCallback(bool result, void* param) { 137 void StartUpdateCallback(bool result, void* param) {
145 last_start_result_ = result; 138 last_start_result_ = result;
146 last_callback_param_ = param; 139 last_callback_param_ = param;
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 EXPECT_EQ(&mock_frontend_, host.frontend()); 524 EXPECT_EQ(&mock_frontend_, host.frontend());
532 EXPECT_EQ(NULL, host.associated_cache()); 525 EXPECT_EQ(NULL, host.associated_cache());
533 EXPECT_FALSE(host.is_selection_pending()); 526 EXPECT_FALSE(host.is_selection_pending());
534 EXPECT_TRUE(host.preferred_manifest_url().is_empty()); 527 EXPECT_TRUE(host.preferred_manifest_url().is_empty());
535 } 528 }
536 EXPECT_EQ(0, mock_quota_proxy->GetInUseCount(kDocAndOriginUrl)); 529 EXPECT_EQ(0, mock_quota_proxy->GetInUseCount(kDocAndOriginUrl));
537 service_.set_quota_manager_proxy(NULL); 530 service_.set_quota_manager_proxy(NULL);
538 } 531 }
539 532
540 } // namespace content 533 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_host.h ('k') | content/browser/appcache/appcache_interceptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698