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 "content/browser/appcache/appcache_host.h" | 5 #include "content/browser/appcache/appcache_host.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/test/scoped_task_environment.h" |
14 #include "content/browser/appcache/appcache.h" | 14 #include "content/browser/appcache/appcache.h" |
15 #include "content/browser/appcache/appcache_backend_impl.h" | 15 #include "content/browser/appcache/appcache_backend_impl.h" |
16 #include "content/browser/appcache/appcache_group.h" | 16 #include "content/browser/appcache/appcache_group.h" |
17 #include "content/browser/appcache/mock_appcache_policy.h" | 17 #include "content/browser/appcache/mock_appcache_policy.h" |
18 #include "content/browser/appcache/mock_appcache_service.h" | 18 #include "content/browser/appcache/mock_appcache_service.h" |
19 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
20 #include "storage/browser/quota/quota_manager.h" | 20 #include "storage/browser/quota/quota_manager.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 namespace content { | 23 namespace content { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void StartUpdateCallback(bool result, void* param) { | 141 void StartUpdateCallback(bool result, void* param) { |
142 last_start_result_ = result; | 142 last_start_result_ = result; |
143 last_callback_param_ = param; | 143 last_callback_param_ = param; |
144 } | 144 } |
145 | 145 |
146 void SwapCacheCallback(bool result, void* param) { | 146 void SwapCacheCallback(bool result, void* param) { |
147 last_swap_result_ = result; | 147 last_swap_result_ = result; |
148 last_callback_param_ = param; | 148 last_callback_param_ = param; |
149 } | 149 } |
150 | 150 |
151 base::MessageLoop message_loop_; | 151 base::test::ScopedTaskEnvironment scoped_task_environment_; |
152 | 152 |
153 // Mock classes for the 'host' to work with | 153 // Mock classes for the 'host' to work with |
154 MockAppCacheService service_; | 154 MockAppCacheService service_; |
155 MockFrontend mock_frontend_; | 155 MockFrontend mock_frontend_; |
156 | 156 |
157 // Mock callbacks we expect to receive from the 'host' | 157 // Mock callbacks we expect to receive from the 'host' |
158 content::GetStatusCallback get_status_callback_; | 158 content::GetStatusCallback get_status_callback_; |
159 content::StartUpdateCallback start_update_callback_; | 159 content::StartUpdateCallback start_update_callback_; |
160 content::SwapCacheCallback swap_cache_callback_; | 160 content::SwapCacheCallback swap_cache_callback_; |
161 | 161 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 EXPECT_TRUE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); | 541 EXPECT_TRUE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); |
542 | 542 |
543 // Select methods should bail if cache has already been selected. | 543 // Select methods should bail if cache has already been selected. |
544 EXPECT_FALSE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); | 544 EXPECT_FALSE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); |
545 EXPECT_FALSE(host.SelectCacheForWorker(0, 0)); | 545 EXPECT_FALSE(host.SelectCacheForWorker(0, 0)); |
546 EXPECT_FALSE(host.SelectCacheForSharedWorker(kAppCacheNoCacheId)); | 546 EXPECT_FALSE(host.SelectCacheForSharedWorker(kAppCacheNoCacheId)); |
547 EXPECT_FALSE(host.MarkAsForeignEntry(kDocAndOriginUrl, kAppCacheNoCacheId)); | 547 EXPECT_FALSE(host.MarkAsForeignEntry(kDocAndOriginUrl, kAppCacheNoCacheId)); |
548 } | 548 } |
549 | 549 |
550 } // namespace content | 550 } // namespace content |
OLD | NEW |