| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 6 |
| 7 #include "base/memory/scoped_callback_factory.h" | 7 #include "base/memory/scoped_callback_factory.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void Call_OnQuotaManagerDestroyed(AppCacheQuotaClient* client) { | 130 void Call_OnQuotaManagerDestroyed(AppCacheQuotaClient* client) { |
| 131 client->OnQuotaManagerDestroyed(); | 131 client->OnQuotaManagerDestroyed(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 protected: | 134 protected: |
| 135 void OnGetOriginUsageComplete(int64 usage) { | 135 void OnGetOriginUsageComplete(int64 usage) { |
| 136 ++num_get_origin_usage_completions_; | 136 ++num_get_origin_usage_completions_; |
| 137 usage_ = usage; | 137 usage_ = usage; |
| 138 } | 138 } |
| 139 | 139 |
| 140 void OnGetOriginsComplete(const std::set<GURL>& origins) { | 140 void OnGetOriginsComplete(const std::set<GURL>& origins, |
| 141 quota::StorageType type) { |
| 141 ++num_get_origins_completions_; | 142 ++num_get_origins_completions_; |
| 142 origins_ = origins; | 143 origins_ = origins; |
| 144 type_ = type; |
| 143 } | 145 } |
| 144 | 146 |
| 145 void OnDeleteOriginDataComplete(quota::QuotaStatusCode status) { | 147 void OnDeleteOriginDataComplete(quota::QuotaStatusCode status) { |
| 146 ++num_delete_origins_completions_; | 148 ++num_delete_origins_completions_; |
| 147 delete_status_ = status; | 149 delete_status_ = status; |
| 148 } | 150 } |
| 149 | 151 |
| 150 int64 usage_; | 152 int64 usage_; |
| 151 std::set<GURL> origins_; | 153 std::set<GURL> origins_; |
| 154 quota::StorageType type_; |
| 152 quota::QuotaStatusCode delete_status_; | 155 quota::QuotaStatusCode delete_status_; |
| 153 int num_get_origin_usage_completions_; | 156 int num_get_origin_usage_completions_; |
| 154 int num_get_origins_completions_; | 157 int num_get_origins_completions_; |
| 155 int num_delete_origins_completions_; | 158 int num_delete_origins_completions_; |
| 156 MockAppCacheService mock_service_; | 159 MockAppCacheService mock_service_; |
| 157 base::ScopedCallbackFactory<AppCacheQuotaClientTest> callback_factory_; | 160 base::ScopedCallbackFactory<AppCacheQuotaClientTest> callback_factory_; |
| 158 }; | 161 }; |
| 159 | 162 |
| 160 | 163 |
| 161 TEST_F(AppCacheQuotaClientTest, BasicCreateDestroy) { | 164 TEST_F(AppCacheQuotaClientTest, BasicCreateDestroy) { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // A real completion callback from the service should | 423 // A real completion callback from the service should |
| 421 // be dropped if it comes in after NotifyAppCacheDestroyed. | 424 // be dropped if it comes in after NotifyAppCacheDestroyed. |
| 422 MessageLoop::current()->RunAllPending(); | 425 MessageLoop::current()->RunAllPending(); |
| 423 EXPECT_EQ(1, num_delete_origins_completions_); | 426 EXPECT_EQ(1, num_delete_origins_completions_); |
| 424 EXPECT_EQ(quota::kQuotaErrorAbort, delete_status_); | 427 EXPECT_EQ(quota::kQuotaErrorAbort, delete_status_); |
| 425 | 428 |
| 426 Call_OnQuotaManagerDestroyed(client); | 429 Call_OnQuotaManagerDestroyed(client); |
| 427 } | 430 } |
| 428 | 431 |
| 429 } // namespace appcache | 432 } // namespace appcache |
| OLD | NEW |