| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "content/browser/browser_thread_impl.h" | 15 #include "content/browser/browser_thread_impl.h" |
| 16 #include "content/browser/gpu/shader_disk_cache.h" | 16 #include "content/browser/gpu/shader_cache_factory.h" |
| 17 #include "content/browser/quota/mock_quota_manager.h" | 17 #include "content/browser/quota/mock_quota_manager.h" |
| 18 #include "content/browser/storage_partition_impl.h" | 18 #include "content/browser/storage_partition_impl.h" |
| 19 #include "content/public/browser/local_storage_usage_info.h" | 19 #include "content/public/browser/local_storage_usage_info.h" |
| 20 #include "content/public/browser/storage_partition.h" | 20 #include "content/public/browser/storage_partition.h" |
| 21 #include "content/public/test/mock_special_storage_policy.h" | 21 #include "content/public/test/mock_special_storage_policy.h" |
| 22 #include "content/public/test/test_browser_context.h" | 22 #include "content/public/test/test_browser_context.h" |
| 23 #include "content/public/test/test_browser_thread.h" | 23 #include "content/public/test/test_browser_thread.h" |
| 24 #include "content/public/test/test_browser_thread_bundle.h" | 24 #include "content/public/test/test_browser_thread_bundle.h" |
| 25 #include "net/base/test_completion_callback.h" | 25 #include "net/base/test_completion_callback.h" |
| 26 #include "net/cookies/canonical_cookie.h" | 26 #include "net/cookies/canonical_cookie.h" |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 scoped_refptr<MockQuotaManager> quota_manager_; | 595 scoped_refptr<MockQuotaManager> quota_manager_; |
| 596 | 596 |
| 597 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImplTest); | 597 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImplTest); |
| 598 }; | 598 }; |
| 599 | 599 |
| 600 class StoragePartitionShaderClearTest : public testing::Test { | 600 class StoragePartitionShaderClearTest : public testing::Test { |
| 601 public: | 601 public: |
| 602 StoragePartitionShaderClearTest() | 602 StoragePartitionShaderClearTest() |
| 603 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 603 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
| 604 browser_context_(new TestBrowserContext()) { | 604 browser_context_(new TestBrowserContext()) { |
| 605 ShaderCacheFactory::InitInstance( | 605 InitShaderCacheFactorySingleton( |
| 606 base::ThreadTaskRunnerHandle::Get(), | 606 base::ThreadTaskRunnerHandle::Get(), |
| 607 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); | 607 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); |
| 608 ShaderCacheFactory::GetInstance()->SetCacheInfo( | 608 GetShaderCacheFactorySingleton()->SetCacheInfo( |
| 609 kDefaultClientId, | 609 kDefaultClientId, |
| 610 BrowserContext::GetDefaultStoragePartition( | 610 BrowserContext::GetDefaultStoragePartition(browser_context()) |
| 611 browser_context())->GetPath()); | 611 ->GetPath()); |
| 612 cache_ = ShaderCacheFactory::GetInstance()->Get(kDefaultClientId); | 612 cache_ = GetShaderCacheFactorySingleton()->Get(kDefaultClientId); |
| 613 } | 613 } |
| 614 | 614 |
| 615 ~StoragePartitionShaderClearTest() override { | 615 ~StoragePartitionShaderClearTest() override { |
| 616 cache_ = NULL; | 616 cache_ = NULL; |
| 617 ShaderCacheFactory::GetInstance()->RemoveCacheInfo(kDefaultClientId); | 617 GetShaderCacheFactorySingleton()->RemoveCacheInfo(kDefaultClientId); |
| 618 } | 618 } |
| 619 | 619 |
| 620 void InitCache() { | 620 void InitCache() { |
| 621 net::TestCompletionCallback available_cb; | 621 net::TestCompletionCallback available_cb; |
| 622 int rv = cache_->SetAvailableCallback(available_cb.callback()); | 622 int rv = cache_->SetAvailableCallback(available_cb.callback()); |
| 623 ASSERT_EQ(net::OK, available_cb.GetResult(rv)); | 623 ASSERT_EQ(net::OK, available_cb.GetResult(rv)); |
| 624 EXPECT_EQ(0, cache_->Size()); | 624 EXPECT_EQ(0, cache_->Size()); |
| 625 | 625 |
| 626 cache_->Cache(kCacheKey, kCacheValue); | 626 cache_->Cache(kCacheKey, kCacheValue); |
| 627 | 627 |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 CanonicalCookie::Create(url2, "A=B;domain=.example.com", now, options)); | 1316 CanonicalCookie::Create(url2, "A=B;domain=.example.com", now, options)); |
| 1317 invalid_cookies.push_back(CanonicalCookie::Create(url3, "A=B", now, options)); | 1317 invalid_cookies.push_back(CanonicalCookie::Create(url3, "A=B", now, options)); |
| 1318 | 1318 |
| 1319 for (const auto& cookie : valid_cookies) | 1319 for (const auto& cookie : valid_cookies) |
| 1320 EXPECT_TRUE(predicate.Run(*cookie)) << cookie->DebugString(); | 1320 EXPECT_TRUE(predicate.Run(*cookie)) << cookie->DebugString(); |
| 1321 for (const auto& cookie : invalid_cookies) | 1321 for (const auto& cookie : invalid_cookies) |
| 1322 EXPECT_FALSE(predicate.Run(*cookie)) << cookie->DebugString(); | 1322 EXPECT_FALSE(predicate.Run(*cookie)) << cookie->DebugString(); |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 } // namespace content | 1325 } // namespace content |
| OLD | NEW |