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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/test/scoped_task_environment.h" |
12 #include "content/browser/appcache/appcache_quota_client.h" | 13 #include "content/browser/appcache/appcache_quota_client.h" |
13 #include "content/browser/appcache/mock_appcache_service.h" | 14 #include "content/browser/appcache/mock_appcache_service.h" |
14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 // Declared to shorten the line lengths. | 20 // Declared to shorten the line lengths. |
20 static const storage::StorageType kTemp = storage::kStorageTypeTemporary; | 21 static const storage::StorageType kTemp = storage::kStorageTypeTemporary; |
21 static const storage::StorageType kPerm = storage::kStorageTypePersistent; | 22 static const storage::StorageType kPerm = storage::kStorageTypePersistent; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 void OnGetOriginsComplete(const std::set<GURL>& origins) { | 138 void OnGetOriginsComplete(const std::set<GURL>& origins) { |
138 ++num_get_origins_completions_; | 139 ++num_get_origins_completions_; |
139 origins_ = origins; | 140 origins_ = origins; |
140 } | 141 } |
141 | 142 |
142 void OnDeleteOriginDataComplete(storage::QuotaStatusCode status) { | 143 void OnDeleteOriginDataComplete(storage::QuotaStatusCode status) { |
143 ++num_delete_origins_completions_; | 144 ++num_delete_origins_completions_; |
144 delete_status_ = status; | 145 delete_status_ = status; |
145 } | 146 } |
146 | 147 |
147 base::MessageLoop message_loop_; | 148 base::test::ScopedTaskEnvironment scoped_task_environment_; |
148 int64_t usage_; | 149 int64_t usage_; |
149 std::set<GURL> origins_; | 150 std::set<GURL> origins_; |
150 storage::QuotaStatusCode delete_status_; | 151 storage::QuotaStatusCode delete_status_; |
151 int num_get_origin_usage_completions_; | 152 int num_get_origin_usage_completions_; |
152 int num_get_origins_completions_; | 153 int num_get_origins_completions_; |
153 int num_delete_origins_completions_; | 154 int num_delete_origins_completions_; |
154 MockAppCacheService mock_service_; | 155 MockAppCacheService mock_service_; |
155 base::WeakPtrFactory<AppCacheQuotaClientTest> weak_factory_; | 156 base::WeakPtrFactory<AppCacheQuotaClientTest> weak_factory_; |
156 }; | 157 }; |
157 | 158 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 // A real completion callback from the service should | 417 // A real completion callback from the service should |
417 // be dropped if it comes in after NotifyAppCacheDestroyed. | 418 // be dropped if it comes in after NotifyAppCacheDestroyed. |
418 base::RunLoop().RunUntilIdle(); | 419 base::RunLoop().RunUntilIdle(); |
419 EXPECT_EQ(1, num_delete_origins_completions_); | 420 EXPECT_EQ(1, num_delete_origins_completions_); |
420 EXPECT_EQ(storage::kQuotaErrorAbort, delete_status_); | 421 EXPECT_EQ(storage::kQuotaErrorAbort, delete_status_); |
421 | 422 |
422 Call_OnQuotaManagerDestroyed(client); | 423 Call_OnQuotaManagerDestroyed(client); |
423 } | 424 } |
424 | 425 |
425 } // namespace content | 426 } // namespace content |
OLD | NEW |