OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 void Call_OnQuotaManagerDestroyed(AppCacheQuotaClient* client) { | 135 void Call_OnQuotaManagerDestroyed(AppCacheQuotaClient* client) { |
136 client->OnQuotaManagerDestroyed(); | 136 client->OnQuotaManagerDestroyed(); |
137 } | 137 } |
138 | 138 |
139 protected: | 139 protected: |
140 void OnGetOriginUsageComplete(int64 usage) { | 140 void OnGetOriginUsageComplete(int64 usage) { |
141 ++num_get_origin_usage_completions_; | 141 ++num_get_origin_usage_completions_; |
142 usage_ = usage; | 142 usage_ = usage; |
143 } | 143 } |
144 | 144 |
145 void OnGetOriginsComplete(const std::set<GURL>& origins, | 145 void OnGetOriginsComplete(const std::set<GURL>& origins) { |
146 quota::StorageType type) { | |
147 ++num_get_origins_completions_; | 146 ++num_get_origins_completions_; |
148 origins_ = origins; | 147 origins_ = origins; |
149 type_ = type; | |
150 } | 148 } |
151 | 149 |
152 void OnDeleteOriginDataComplete(quota::QuotaStatusCode status) { | 150 void OnDeleteOriginDataComplete(quota::QuotaStatusCode status) { |
153 ++num_delete_origins_completions_; | 151 ++num_delete_origins_completions_; |
154 delete_status_ = status; | 152 delete_status_ = status; |
155 } | 153 } |
156 | 154 |
157 base::MessageLoop message_loop_; | 155 base::MessageLoop message_loop_; |
158 int64 usage_; | 156 int64 usage_; |
159 std::set<GURL> origins_; | 157 std::set<GURL> origins_; |
160 quota::StorageType type_; | |
161 quota::QuotaStatusCode delete_status_; | 158 quota::QuotaStatusCode delete_status_; |
162 int num_get_origin_usage_completions_; | 159 int num_get_origin_usage_completions_; |
163 int num_get_origins_completions_; | 160 int num_get_origins_completions_; |
164 int num_delete_origins_completions_; | 161 int num_delete_origins_completions_; |
165 MockAppCacheService mock_service_; | 162 MockAppCacheService mock_service_; |
166 base::WeakPtrFactory<AppCacheQuotaClientTest> weak_factory_; | 163 base::WeakPtrFactory<AppCacheQuotaClientTest> weak_factory_; |
167 }; | 164 }; |
168 | 165 |
169 | 166 |
170 TEST_F(AppCacheQuotaClientTest, BasicCreateDestroy) { | 167 TEST_F(AppCacheQuotaClientTest, BasicCreateDestroy) { |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 // A real completion callback from the service should | 426 // A real completion callback from the service should |
430 // be dropped if it comes in after NotifyAppCacheDestroyed. | 427 // be dropped if it comes in after NotifyAppCacheDestroyed. |
431 base::MessageLoop::current()->RunUntilIdle(); | 428 base::MessageLoop::current()->RunUntilIdle(); |
432 EXPECT_EQ(1, num_delete_origins_completions_); | 429 EXPECT_EQ(1, num_delete_origins_completions_); |
433 EXPECT_EQ(quota::kQuotaErrorAbort, delete_status_); | 430 EXPECT_EQ(quota::kQuotaErrorAbort, delete_status_); |
434 | 431 |
435 Call_OnQuotaManagerDestroyed(client); | 432 Call_OnQuotaManagerDestroyed(client); |
436 } | 433 } |
437 | 434 |
438 } // namespace appcache | 435 } // namespace appcache |
OLD | NEW |