| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 const net::HttpResponseInfo* info) { | 176 const net::HttpResponseInfo* info) { |
| 177 const bool kSkipTransientHeaders = true; | 177 const bool kSkipTransientHeaders = true; |
| 178 const bool kTruncated = false; | 178 const bool kTruncated = false; |
| 179 info->Persist(pickle, kSkipTransientHeaders, kTruncated); | 179 info->Persist(pickle, kSkipTransientHeaders, kTruncated); |
| 180 return pickle->size(); | 180 return pickle->size(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 const GURL kOrigin; | 183 const GURL kOrigin; |
| 184 const GURL kManifestUrl; | 184 const GURL kManifestUrl; |
| 185 | 185 |
| 186 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 186 std::unique_ptr<AppCacheServiceImpl> service_; | 187 std::unique_ptr<AppCacheServiceImpl> service_; |
| 187 int delete_result_; | 188 int delete_result_; |
| 188 int delete_completion_count_; | 189 int delete_completion_count_; |
| 189 net::CompletionCallback deletion_callback_; | 190 net::CompletionCallback deletion_callback_; |
| 190 | |
| 191 private: | |
| 192 base::test::ScopedTaskEnvironment scoped_task_environment_; | |
| 193 }; | 191 }; |
| 194 | 192 |
| 195 TEST_F(AppCacheServiceImplTest, DeleteAppCachesForOrigin) { | 193 TEST_F(AppCacheServiceImplTest, DeleteAppCachesForOrigin) { |
| 196 // Without giving mock storage simiulated info, should fail. | 194 // Without giving mock storage simiulated info, should fail. |
| 197 service_->DeleteAppCachesForOrigin(kOrigin, deletion_callback_); | 195 service_->DeleteAppCachesForOrigin(kOrigin, deletion_callback_); |
| 198 EXPECT_EQ(0, delete_completion_count_); | 196 EXPECT_EQ(0, delete_completion_count_); |
| 199 base::RunLoop().RunUntilIdle(); | 197 base::RunLoop().RunUntilIdle(); |
| 200 EXPECT_EQ(1, delete_completion_count_); | 198 EXPECT_EQ(1, delete_completion_count_); |
| 201 EXPECT_EQ(net::ERR_FAILED, delete_result_); | 199 EXPECT_EQ(net::ERR_FAILED, delete_result_); |
| 202 delete_completion_count_ = 0; | 200 delete_completion_count_ = 0; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 EXPECT_EQ(kOneHour, service->reinit_timer_.GetCurrentDelay()); | 378 EXPECT_EQ(kOneHour, service->reinit_timer_.GetCurrentDelay()); |
| 381 EXPECT_EQ(kOneHour, service->next_reinit_delay_); | 379 EXPECT_EQ(kOneHour, service->next_reinit_delay_); |
| 382 | 380 |
| 383 // Fine to delete while pending. | 381 // Fine to delete while pending. |
| 384 service.reset(NULL); | 382 service.reset(NULL); |
| 385 } | 383 } |
| 386 | 384 |
| 387 | 385 |
| 388 | 386 |
| 389 } // namespace content | 387 } // namespace content |
| OLD | NEW |