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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } // namespace | 82 } // namespace |
83 | 83 |
84 | 84 |
85 class AppCacheServiceTest : public testing::Test { | 85 class AppCacheServiceTest : public testing::Test { |
86 public: | 86 public: |
87 AppCacheServiceTest() | 87 AppCacheServiceTest() |
88 : kOrigin("http://hello/"), | 88 : kOrigin("http://hello/"), |
89 kManifestUrl(kOrigin.Resolve("manifest")), | 89 kManifestUrl(kOrigin.Resolve("manifest")), |
90 service_(new AppCacheService(NULL)), | 90 service_(new AppCacheService(NULL)), |
91 delete_result_(net::OK), delete_completion_count_(0), | 91 delete_result_(net::OK), delete_completion_count_(0), |
92 ALLOW_THIS_IN_INITIALIZER_LIST(deletion_callback_( | 92 deletion_callback_( |
93 base::Bind(&AppCacheServiceTest::OnDeleteAppCachesComplete, | 93 base::Bind(&AppCacheServiceTest::OnDeleteAppCachesComplete, |
94 base::Unretained(this)))) { | 94 base::Unretained(this))) { |
95 // Setup to use mock storage. | 95 // Setup to use mock storage. |
96 service_->storage_.reset(new MockAppCacheStorage(service_.get())); | 96 service_->storage_.reset(new MockAppCacheStorage(service_.get())); |
97 } | 97 } |
98 | 98 |
99 void OnDeleteAppCachesComplete(int result) { | 99 void OnDeleteAppCachesComplete(int result) { |
100 delete_result_ = result; | 100 delete_result_ = result; |
101 ++delete_completion_count_; | 101 ++delete_completion_count_; |
102 } | 102 } |
103 | 103 |
104 MockAppCacheStorage* mock_storage() { | 104 MockAppCacheStorage* mock_storage() { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 MessageLoop::current()->RunUntilIdle(); | 312 MessageLoop::current()->RunUntilIdle(); |
313 EXPECT_EQ(0, CountPendingHelpers()); | 313 EXPECT_EQ(0, CountPendingHelpers()); |
314 EXPECT_FALSE(IsGroupStored(kManifestUrl)); | 314 EXPECT_FALSE(IsGroupStored(kManifestUrl)); |
315 ResetStorage(); | 315 ResetStorage(); |
316 | 316 |
317 service_.reset(); // Clean up. | 317 service_.reset(); // Clean up. |
318 MessageLoop::current()->RunUntilIdle(); | 318 MessageLoop::current()->RunUntilIdle(); |
319 } | 319 } |
320 | 320 |
321 } // namespace appcache | 321 } // namespace appcache |
OLD | NEW |