| 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/cache_storage/cache_storage_manager.h" | 5 #include "content/browser/cache_storage/cache_storage_manager.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "storage/browser/quota/quota_manager_proxy.h" | 21 #include "storage/browser/quota/quota_manager_proxy.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 | 25 |
| 26 class CacheStorageManagerTest : public testing::Test { | 26 class CacheStorageManagerTest : public testing::Test { |
| 27 public: | 27 public: |
| 28 CacheStorageManagerTest() | 28 CacheStorageManagerTest() |
| 29 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), | 29 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), |
| 30 callback_bool_(false), | 30 callback_bool_(false), |
| 31 callback_error_(CacheStorage::CACHE_STORAGE_ERROR_NO_ERROR), | 31 callback_error_(CACHE_STORAGE_OK), |
| 32 callback_cache_error_(CacheStorageCache::ERROR_TYPE_OK), | 32 callback_cache_error_(CACHE_STORAGE_OK), |
| 33 origin1_("http://example1.com"), | 33 origin1_("http://example1.com"), |
| 34 origin2_("http://example2.com") {} | 34 origin2_("http://example2.com") {} |
| 35 | 35 |
| 36 void SetUp() override { | 36 void SetUp() override { |
| 37 ChromeBlobStorageContext* blob_storage_context( | 37 ChromeBlobStorageContext* blob_storage_context( |
| 38 ChromeBlobStorageContext::GetFor(&browser_context_)); | 38 ChromeBlobStorageContext::GetFor(&browser_context_)); |
| 39 // Wait for ChromeBlobStorageContext to finish initializing. | 39 // Wait for ChromeBlobStorageContext to finish initializing. |
| 40 base::RunLoop().RunUntilIdle(); | 40 base::RunLoop().RunUntilIdle(); |
| 41 | 41 |
| 42 quota_manager_proxy_ = new MockQuotaManagerProxy( | 42 quota_manager_proxy_ = new MockQuotaManagerProxy( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 61 | 61 |
| 62 void TearDown() override { | 62 void TearDown() override { |
| 63 quota_manager_proxy_->SimulateQuotaManagerDestroyed(); | 63 quota_manager_proxy_->SimulateQuotaManagerDestroyed(); |
| 64 base::RunLoop().RunUntilIdle(); | 64 base::RunLoop().RunUntilIdle(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual bool MemoryOnly() { return false; } | 67 virtual bool MemoryOnly() { return false; } |
| 68 | 68 |
| 69 void BoolAndErrorCallback(base::RunLoop* run_loop, | 69 void BoolAndErrorCallback(base::RunLoop* run_loop, |
| 70 bool value, | 70 bool value, |
| 71 CacheStorage::CacheStorageError error) { | 71 CacheStorageError error) { |
| 72 callback_bool_ = value; | 72 callback_bool_ = value; |
| 73 callback_error_ = error; | 73 callback_error_ = error; |
| 74 run_loop->Quit(); | 74 run_loop->Quit(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void CacheAndErrorCallback(base::RunLoop* run_loop, | 77 void CacheAndErrorCallback(base::RunLoop* run_loop, |
| 78 const scoped_refptr<CacheStorageCache>& cache, | 78 const scoped_refptr<CacheStorageCache>& cache, |
| 79 CacheStorage::CacheStorageError error) { | 79 CacheStorageError error) { |
| 80 callback_cache_ = cache; | 80 callback_cache_ = cache; |
| 81 callback_error_ = error; | 81 callback_error_ = error; |
| 82 run_loop->Quit(); | 82 run_loop->Quit(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void StringsAndErrorCallback(base::RunLoop* run_loop, | 85 void StringsAndErrorCallback(base::RunLoop* run_loop, |
| 86 const std::vector<std::string>& strings, | 86 const std::vector<std::string>& strings, |
| 87 CacheStorage::CacheStorageError error) { | 87 CacheStorageError error) { |
| 88 callback_strings_ = strings; | 88 callback_strings_ = strings; |
| 89 callback_error_ = error; | 89 callback_error_ = error; |
| 90 run_loop->Quit(); | 90 run_loop->Quit(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void CachePutCallback(base::RunLoop* run_loop, | 93 void CachePutCallback(base::RunLoop* run_loop, CacheStorageError error) { |
| 94 CacheStorageCache::ErrorType error) { | |
| 95 callback_cache_error_ = error; | 94 callback_cache_error_ = error; |
| 96 run_loop->Quit(); | 95 run_loop->Quit(); |
| 97 } | 96 } |
| 98 | 97 |
| 99 void CacheMatchCallback( | 98 void CacheMatchCallback( |
| 100 base::RunLoop* run_loop, | 99 base::RunLoop* run_loop, |
| 101 CacheStorageCache::ErrorType error, | 100 CacheStorageError error, |
| 102 scoped_ptr<ServiceWorkerResponse> response, | 101 scoped_ptr<ServiceWorkerResponse> response, |
| 103 scoped_ptr<storage::BlobDataHandle> blob_data_handle) { | 102 scoped_ptr<storage::BlobDataHandle> blob_data_handle) { |
| 104 callback_cache_error_ = error; | 103 callback_cache_error_ = error; |
| 105 callback_cache_response_ = response.Pass(); | 104 callback_cache_response_ = response.Pass(); |
| 106 // Deliberately drop the data handle as only the url is being tested. | 105 // Deliberately drop the data handle as only the url is being tested. |
| 107 run_loop->Quit(); | 106 run_loop->Quit(); |
| 108 } | 107 } |
| 109 | 108 |
| 110 bool Open(const GURL& origin, const std::string& cache_name) { | 109 bool Open(const GURL& origin, const std::string& cache_name) { |
| 111 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); | 110 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); |
| 112 cache_manager_->OpenCache( | 111 cache_manager_->OpenCache( |
| 113 origin, cache_name, | 112 origin, cache_name, |
| 114 base::Bind(&CacheStorageManagerTest::CacheAndErrorCallback, | 113 base::Bind(&CacheStorageManagerTest::CacheAndErrorCallback, |
| 115 base::Unretained(this), base::Unretained(loop.get()))); | 114 base::Unretained(this), base::Unretained(loop.get()))); |
| 116 loop->Run(); | 115 loop->Run(); |
| 117 | 116 |
| 118 bool error = callback_error_ != CacheStorage::CACHE_STORAGE_ERROR_NO_ERROR; | 117 bool error = callback_error_ != CACHE_STORAGE_OK; |
| 119 if (error) | 118 if (error) |
| 120 EXPECT_TRUE(!callback_cache_.get()); | 119 EXPECT_TRUE(!callback_cache_.get()); |
| 121 else | 120 else |
| 122 EXPECT_TRUE(callback_cache_.get()); | 121 EXPECT_TRUE(callback_cache_.get()); |
| 123 return !error; | 122 return !error; |
| 124 } | 123 } |
| 125 | 124 |
| 126 bool Has(const GURL& origin, const std::string& cache_name) { | 125 bool Has(const GURL& origin, const std::string& cache_name) { |
| 127 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); | 126 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); |
| 128 cache_manager_->HasCache( | 127 cache_manager_->HasCache( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 146 } | 145 } |
| 147 | 146 |
| 148 bool Keys(const GURL& origin) { | 147 bool Keys(const GURL& origin) { |
| 149 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); | 148 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); |
| 150 cache_manager_->EnumerateCaches( | 149 cache_manager_->EnumerateCaches( |
| 151 origin, | 150 origin, |
| 152 base::Bind(&CacheStorageManagerTest::StringsAndErrorCallback, | 151 base::Bind(&CacheStorageManagerTest::StringsAndErrorCallback, |
| 153 base::Unretained(this), base::Unretained(loop.get()))); | 152 base::Unretained(this), base::Unretained(loop.get()))); |
| 154 loop->Run(); | 153 loop->Run(); |
| 155 | 154 |
| 156 bool error = callback_error_ != CacheStorage::CACHE_STORAGE_ERROR_NO_ERROR; | 155 bool error = callback_error_ != CACHE_STORAGE_OK; |
| 157 return !error; | 156 return !error; |
| 158 } | 157 } |
| 159 | 158 |
| 160 bool StorageMatch(const GURL& origin, | 159 bool StorageMatch(const GURL& origin, |
| 161 const std::string& cache_name, | 160 const std::string& cache_name, |
| 162 const GURL& url) { | 161 const GURL& url) { |
| 163 scoped_ptr<ServiceWorkerFetchRequest> request( | 162 scoped_ptr<ServiceWorkerFetchRequest> request( |
| 164 new ServiceWorkerFetchRequest()); | 163 new ServiceWorkerFetchRequest()); |
| 165 request->url = url; | 164 request->url = url; |
| 166 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); | 165 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); |
| 167 cache_manager_->MatchCache( | 166 cache_manager_->MatchCache( |
| 168 origin, cache_name, request.Pass(), | 167 origin, cache_name, request.Pass(), |
| 169 base::Bind(&CacheStorageManagerTest::CacheMatchCallback, | 168 base::Bind(&CacheStorageManagerTest::CacheMatchCallback, |
| 170 base::Unretained(this), base::Unretained(loop.get()))); | 169 base::Unretained(this), base::Unretained(loop.get()))); |
| 171 loop->Run(); | 170 loop->Run(); |
| 172 | 171 |
| 173 bool error = callback_cache_error_ != CacheStorageCache::ERROR_TYPE_OK; | 172 bool error = callback_cache_error_ != CACHE_STORAGE_OK; |
| 174 return !error; | 173 return !error; |
| 175 } | 174 } |
| 176 | 175 |
| 177 bool StorageMatchAll(const GURL& origin, const GURL& url) { | 176 bool StorageMatchAll(const GURL& origin, const GURL& url) { |
| 178 scoped_ptr<ServiceWorkerFetchRequest> request( | 177 scoped_ptr<ServiceWorkerFetchRequest> request( |
| 179 new ServiceWorkerFetchRequest()); | 178 new ServiceWorkerFetchRequest()); |
| 180 request->url = url; | 179 request->url = url; |
| 181 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); | 180 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); |
| 182 cache_manager_->MatchAllCaches( | 181 cache_manager_->MatchAllCaches( |
| 183 origin, request.Pass(), | 182 origin, request.Pass(), |
| 184 base::Bind(&CacheStorageManagerTest::CacheMatchCallback, | 183 base::Bind(&CacheStorageManagerTest::CacheMatchCallback, |
| 185 base::Unretained(this), base::Unretained(loop.get()))); | 184 base::Unretained(this), base::Unretained(loop.get()))); |
| 186 loop->Run(); | 185 loop->Run(); |
| 187 | 186 |
| 188 bool error = callback_cache_error_ != CacheStorageCache::ERROR_TYPE_OK; | 187 bool error = callback_cache_error_ != CACHE_STORAGE_OK; |
| 189 return !error; | 188 return !error; |
| 190 } | 189 } |
| 191 | 190 |
| 192 bool CachePut(const scoped_refptr<CacheStorageCache>& cache, | 191 bool CachePut(const scoped_refptr<CacheStorageCache>& cache, |
| 193 const GURL& url) { | 192 const GURL& url) { |
| 194 scoped_ptr<ServiceWorkerFetchRequest> request( | 193 scoped_ptr<ServiceWorkerFetchRequest> request( |
| 195 new ServiceWorkerFetchRequest()); | 194 new ServiceWorkerFetchRequest()); |
| 196 scoped_ptr<ServiceWorkerResponse> response(new ServiceWorkerResponse()); | 195 scoped_ptr<ServiceWorkerResponse> response(new ServiceWorkerResponse()); |
| 197 request->url = url; | 196 request->url = url; |
| 198 response->url = url; | 197 response->url = url; |
| 199 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); | 198 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); |
| 200 cache->Put( | 199 cache->Put( |
| 201 request.Pass(), response.Pass(), | 200 request.Pass(), response.Pass(), |
| 202 base::Bind(&CacheStorageManagerTest::CachePutCallback, | 201 base::Bind(&CacheStorageManagerTest::CachePutCallback, |
| 203 base::Unretained(this), base::Unretained(loop.get()))); | 202 base::Unretained(this), base::Unretained(loop.get()))); |
| 204 loop->Run(); | 203 loop->Run(); |
| 205 | 204 |
| 206 bool error = callback_cache_error_ != CacheStorageCache::ERROR_TYPE_OK; | 205 bool error = callback_cache_error_ != CACHE_STORAGE_OK; |
| 207 return !error; | 206 return !error; |
| 208 } | 207 } |
| 209 | 208 |
| 210 bool CacheMatch(const scoped_refptr<CacheStorageCache>& cache, | 209 bool CacheMatch(const scoped_refptr<CacheStorageCache>& cache, |
| 211 const GURL& url) { | 210 const GURL& url) { |
| 212 scoped_ptr<ServiceWorkerFetchRequest> request( | 211 scoped_ptr<ServiceWorkerFetchRequest> request( |
| 213 new ServiceWorkerFetchRequest()); | 212 new ServiceWorkerFetchRequest()); |
| 214 request->url = url; | 213 request->url = url; |
| 215 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); | 214 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); |
| 216 cache->Match( | 215 cache->Match( |
| 217 request.Pass(), | 216 request.Pass(), |
| 218 base::Bind(&CacheStorageManagerTest::CacheMatchCallback, | 217 base::Bind(&CacheStorageManagerTest::CacheMatchCallback, |
| 219 base::Unretained(this), base::Unretained(loop.get()))); | 218 base::Unretained(this), base::Unretained(loop.get()))); |
| 220 loop->Run(); | 219 loop->Run(); |
| 221 | 220 |
| 222 bool error = callback_cache_error_ != CacheStorageCache::ERROR_TYPE_OK; | 221 bool error = callback_cache_error_ != CACHE_STORAGE_OK; |
| 223 return !error; | 222 return !error; |
| 224 } | 223 } |
| 225 | 224 |
| 226 CacheStorage* CacheStorageForOrigin(const GURL& origin) { | 225 CacheStorage* CacheStorageForOrigin(const GURL& origin) { |
| 227 return cache_manager_->FindOrCreateCacheStorage(origin); | 226 return cache_manager_->FindOrCreateCacheStorage(origin); |
| 228 } | 227 } |
| 229 | 228 |
| 230 protected: | 229 protected: |
| 231 TestBrowserContext browser_context_; | 230 TestBrowserContext browser_context_; |
| 232 TestBrowserThreadBundle browser_thread_bundle_; | 231 TestBrowserThreadBundle browser_thread_bundle_; |
| 233 | 232 |
| 234 base::ScopedTempDir temp_dir_; | 233 base::ScopedTempDir temp_dir_; |
| 235 scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_; | 234 scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_; |
| 236 scoped_ptr<CacheStorageManager> cache_manager_; | 235 scoped_ptr<CacheStorageManager> cache_manager_; |
| 237 | 236 |
| 238 scoped_refptr<CacheStorageCache> callback_cache_; | 237 scoped_refptr<CacheStorageCache> callback_cache_; |
| 239 int callback_bool_; | 238 int callback_bool_; |
| 240 CacheStorage::CacheStorageError callback_error_; | 239 CacheStorageError callback_error_; |
| 241 CacheStorageCache::ErrorType callback_cache_error_; | 240 CacheStorageError callback_cache_error_; |
| 242 scoped_ptr<ServiceWorkerResponse> callback_cache_response_; | 241 scoped_ptr<ServiceWorkerResponse> callback_cache_response_; |
| 243 std::vector<std::string> callback_strings_; | 242 std::vector<std::string> callback_strings_; |
| 244 | 243 |
| 245 const GURL origin1_; | 244 const GURL origin1_; |
| 246 const GURL origin2_; | 245 const GURL origin2_; |
| 247 | 246 |
| 248 private: | 247 private: |
| 249 DISALLOW_COPY_AND_ASSIGN(CacheStorageManagerTest); | 248 DISALLOW_COPY_AND_ASSIGN(CacheStorageManagerTest); |
| 250 }; | 249 }; |
| 251 | 250 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 TEST_P(CacheStorageManagerTestP, DeleteCache) { | 304 TEST_P(CacheStorageManagerTestP, DeleteCache) { |
| 306 EXPECT_TRUE(Open(origin1_, "foo")); | 305 EXPECT_TRUE(Open(origin1_, "foo")); |
| 307 EXPECT_TRUE(Delete(origin1_, "foo")); | 306 EXPECT_TRUE(Delete(origin1_, "foo")); |
| 308 EXPECT_FALSE(Has(origin1_, "foo")); | 307 EXPECT_FALSE(Has(origin1_, "foo")); |
| 309 } | 308 } |
| 310 | 309 |
| 311 TEST_P(CacheStorageManagerTestP, DeleteTwice) { | 310 TEST_P(CacheStorageManagerTestP, DeleteTwice) { |
| 312 EXPECT_TRUE(Open(origin1_, "foo")); | 311 EXPECT_TRUE(Open(origin1_, "foo")); |
| 313 EXPECT_TRUE(Delete(origin1_, "foo")); | 312 EXPECT_TRUE(Delete(origin1_, "foo")); |
| 314 EXPECT_FALSE(Delete(origin1_, "foo")); | 313 EXPECT_FALSE(Delete(origin1_, "foo")); |
| 315 EXPECT_EQ(CacheStorage::CACHE_STORAGE_ERROR_NOT_FOUND, callback_error_); | 314 EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_error_); |
| 316 } | 315 } |
| 317 | 316 |
| 318 TEST_P(CacheStorageManagerTestP, EmptyKeys) { | 317 TEST_P(CacheStorageManagerTestP, EmptyKeys) { |
| 319 EXPECT_TRUE(Keys(origin1_)); | 318 EXPECT_TRUE(Keys(origin1_)); |
| 320 EXPECT_TRUE(callback_strings_.empty()); | 319 EXPECT_TRUE(callback_strings_.empty()); |
| 321 } | 320 } |
| 322 | 321 |
| 323 TEST_P(CacheStorageManagerTestP, SomeKeys) { | 322 TEST_P(CacheStorageManagerTestP, SomeKeys) { |
| 324 EXPECT_TRUE(Open(origin1_, "foo")); | 323 EXPECT_TRUE(Open(origin1_, "foo")); |
| 325 EXPECT_TRUE(Open(origin1_, "bar")); | 324 EXPECT_TRUE(Open(origin1_, "bar")); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 348 TEST_P(CacheStorageManagerTestP, StorageMatchEntryExists) { | 347 TEST_P(CacheStorageManagerTestP, StorageMatchEntryExists) { |
| 349 EXPECT_TRUE(Open(origin1_, "foo")); | 348 EXPECT_TRUE(Open(origin1_, "foo")); |
| 350 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); | 349 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); |
| 351 EXPECT_TRUE(StorageMatch(origin1_, "foo", GURL("http://example.com/foo"))); | 350 EXPECT_TRUE(StorageMatch(origin1_, "foo", GURL("http://example.com/foo"))); |
| 352 } | 351 } |
| 353 | 352 |
| 354 TEST_P(CacheStorageManagerTestP, StorageMatchNoEntry) { | 353 TEST_P(CacheStorageManagerTestP, StorageMatchNoEntry) { |
| 355 EXPECT_TRUE(Open(origin1_, "foo")); | 354 EXPECT_TRUE(Open(origin1_, "foo")); |
| 356 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); | 355 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); |
| 357 EXPECT_FALSE(StorageMatch(origin1_, "foo", GURL("http://example.com/bar"))); | 356 EXPECT_FALSE(StorageMatch(origin1_, "foo", GURL("http://example.com/bar"))); |
| 358 EXPECT_EQ(CacheStorageCache::ERROR_TYPE_NOT_FOUND, callback_cache_error_); | 357 EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_cache_error_); |
| 359 } | 358 } |
| 360 | 359 |
| 361 TEST_P(CacheStorageManagerTestP, StorageMatchNoCache) { | 360 TEST_P(CacheStorageManagerTestP, StorageMatchNoCache) { |
| 362 EXPECT_TRUE(Open(origin1_, "foo")); | 361 EXPECT_TRUE(Open(origin1_, "foo")); |
| 363 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); | 362 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); |
| 364 EXPECT_FALSE(StorageMatch(origin1_, "bar", GURL("http://example.com/foo"))); | 363 EXPECT_FALSE(StorageMatch(origin1_, "bar", GURL("http://example.com/foo"))); |
| 365 EXPECT_EQ(CacheStorageCache::ERROR_TYPE_NOT_FOUND, callback_cache_error_); | 364 EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_cache_error_); |
| 366 } | 365 } |
| 367 | 366 |
| 368 TEST_P(CacheStorageManagerTestP, StorageMatchAllEntryExists) { | 367 TEST_P(CacheStorageManagerTestP, StorageMatchAllEntryExists) { |
| 369 EXPECT_TRUE(Open(origin1_, "foo")); | 368 EXPECT_TRUE(Open(origin1_, "foo")); |
| 370 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); | 369 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); |
| 371 EXPECT_TRUE(StorageMatchAll(origin1_, GURL("http://example.com/foo"))); | 370 EXPECT_TRUE(StorageMatchAll(origin1_, GURL("http://example.com/foo"))); |
| 372 } | 371 } |
| 373 | 372 |
| 374 TEST_P(CacheStorageManagerTestP, StorageMatchAllNoEntry) { | 373 TEST_P(CacheStorageManagerTestP, StorageMatchAllNoEntry) { |
| 375 EXPECT_TRUE(Open(origin1_, "foo")); | 374 EXPECT_TRUE(Open(origin1_, "foo")); |
| 376 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); | 375 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); |
| 377 EXPECT_FALSE(StorageMatchAll(origin1_, GURL("http://example.com/bar"))); | 376 EXPECT_FALSE(StorageMatchAll(origin1_, GURL("http://example.com/bar"))); |
| 378 EXPECT_EQ(CacheStorageCache::ERROR_TYPE_NOT_FOUND, callback_cache_error_); | 377 EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_cache_error_); |
| 379 } | 378 } |
| 380 | 379 |
| 381 TEST_P(CacheStorageManagerTestP, StorageMatchAllNoCaches) { | 380 TEST_P(CacheStorageManagerTestP, StorageMatchAllNoCaches) { |
| 382 EXPECT_FALSE(StorageMatchAll(origin1_, GURL("http://example.com/foo"))); | 381 EXPECT_FALSE(StorageMatchAll(origin1_, GURL("http://example.com/foo"))); |
| 383 EXPECT_EQ(CacheStorageCache::ERROR_TYPE_NOT_FOUND, callback_cache_error_); | 382 EXPECT_EQ(CACHE_STORAGE_ERROR_NOT_FOUND, callback_cache_error_); |
| 384 } | 383 } |
| 385 | 384 |
| 386 TEST_P(CacheStorageManagerTestP, StorageMatchAllEntryExistsTwice) { | 385 TEST_P(CacheStorageManagerTestP, StorageMatchAllEntryExistsTwice) { |
| 387 EXPECT_TRUE(Open(origin1_, "foo")); | 386 EXPECT_TRUE(Open(origin1_, "foo")); |
| 388 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); | 387 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); |
| 389 EXPECT_TRUE(Open(origin1_, "bar")); | 388 EXPECT_TRUE(Open(origin1_, "bar")); |
| 390 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); | 389 EXPECT_TRUE(CachePut(callback_cache_, GURL("http://example.com/foo"))); |
| 391 | 390 |
| 392 EXPECT_TRUE(StorageMatchAll(origin1_, GURL("http://example.com/foo"))); | 391 EXPECT_TRUE(StorageMatchAll(origin1_, GURL("http://example.com/foo"))); |
| 393 } | 392 } |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 | 793 |
| 795 INSTANTIATE_TEST_CASE_P(CacheStorageManagerTests, | 794 INSTANTIATE_TEST_CASE_P(CacheStorageManagerTests, |
| 796 CacheStorageManagerTestP, | 795 CacheStorageManagerTestP, |
| 797 ::testing::Values(false, true)); | 796 ::testing::Values(false, true)); |
| 798 | 797 |
| 799 INSTANTIATE_TEST_CASE_P(CacheStorageQuotaClientTests, | 798 INSTANTIATE_TEST_CASE_P(CacheStorageQuotaClientTests, |
| 800 CacheStorageQuotaClientTestP, | 799 CacheStorageQuotaClientTestP, |
| 801 ::testing::Values(false, true)); | 800 ::testing::Values(false, true)); |
| 802 | 801 |
| 803 } // namespace content | 802 } // namespace content |
| OLD | NEW |