| 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" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 } | 343 } |
| 344 return quota_manager_.get(); | 344 return quota_manager_.get(); |
| 345 } | 345 } |
| 346 | 346 |
| 347 TestBrowserContext* browser_context() { | 347 TestBrowserContext* browser_context() { |
| 348 return browser_context_.get(); | 348 return browser_context_.get(); |
| 349 } | 349 } |
| 350 | 350 |
| 351 private: | 351 private: |
| 352 content::TestBrowserThreadBundle thread_bundle_; | 352 content::TestBrowserThreadBundle thread_bundle_; |
| 353 scoped_ptr<TestBrowserContext> browser_context_; | 353 std::unique_ptr<TestBrowserContext> browser_context_; |
| 354 scoped_refptr<MockQuotaManager> quota_manager_; | 354 scoped_refptr<MockQuotaManager> quota_manager_; |
| 355 | 355 |
| 356 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImplTest); | 356 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImplTest); |
| 357 }; | 357 }; |
| 358 | 358 |
| 359 class StoragePartitionShaderClearTest : public testing::Test { | 359 class StoragePartitionShaderClearTest : public testing::Test { |
| 360 public: | 360 public: |
| 361 StoragePartitionShaderClearTest() | 361 StoragePartitionShaderClearTest() |
| 362 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 362 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
| 363 browser_context_(new TestBrowserContext()) { | 363 browser_context_(new TestBrowserContext()) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 388 } | 388 } |
| 389 | 389 |
| 390 size_t Size() { return cache_->Size(); } | 390 size_t Size() { return cache_->Size(); } |
| 391 | 391 |
| 392 TestBrowserContext* browser_context() { | 392 TestBrowserContext* browser_context() { |
| 393 return browser_context_.get(); | 393 return browser_context_.get(); |
| 394 } | 394 } |
| 395 | 395 |
| 396 private: | 396 private: |
| 397 content::TestBrowserThreadBundle thread_bundle_; | 397 content::TestBrowserThreadBundle thread_bundle_; |
| 398 scoped_ptr<TestBrowserContext> browser_context_; | 398 std::unique_ptr<TestBrowserContext> browser_context_; |
| 399 | 399 |
| 400 scoped_refptr<ShaderDiskCache> cache_; | 400 scoped_refptr<ShaderDiskCache> cache_; |
| 401 }; | 401 }; |
| 402 | 402 |
| 403 // Tests --------------------------------------------------------------------- | 403 // Tests --------------------------------------------------------------------- |
| 404 | 404 |
| 405 TEST_F(StoragePartitionShaderClearTest, ClearShaderCache) { | 405 TEST_F(StoragePartitionShaderClearTest, ClearShaderCache) { |
| 406 InitCache(); | 406 InitCache(); |
| 407 EXPECT_EQ(1u, Size()); | 407 EXPECT_EQ(1u, Size()); |
| 408 | 408 |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 TEST(StoragePartitionImplStaticTest, CreatePredicateForHostCookies) { | 925 TEST(StoragePartitionImplStaticTest, CreatePredicateForHostCookies) { |
| 926 GURL url("http://www.example.com/"); | 926 GURL url("http://www.example.com/"); |
| 927 GURL url2("https://www.example.com/"); | 927 GURL url2("https://www.example.com/"); |
| 928 GURL url3("https://www.google.com/"); | 928 GURL url3("https://www.google.com/"); |
| 929 | 929 |
| 930 net::CookieOptions options; | 930 net::CookieOptions options; |
| 931 net::CookieStore::CookiePredicate predicate = | 931 net::CookieStore::CookiePredicate predicate = |
| 932 StoragePartitionImpl::CreatePredicateForHostCookies(url); | 932 StoragePartitionImpl::CreatePredicateForHostCookies(url); |
| 933 | 933 |
| 934 base::Time now = base::Time::Now(); | 934 base::Time now = base::Time::Now(); |
| 935 std::vector<scoped_ptr<CanonicalCookie>> valid_cookies; | 935 std::vector<std::unique_ptr<CanonicalCookie>> valid_cookies; |
| 936 valid_cookies.push_back(CanonicalCookie::Create(url, "A=B", now, options)); | 936 valid_cookies.push_back(CanonicalCookie::Create(url, "A=B", now, options)); |
| 937 valid_cookies.push_back(CanonicalCookie::Create(url, "C=F", now, options)); | 937 valid_cookies.push_back(CanonicalCookie::Create(url, "C=F", now, options)); |
| 938 // We should match a different scheme with the same host. | 938 // We should match a different scheme with the same host. |
| 939 valid_cookies.push_back(CanonicalCookie::Create(url2, "A=B", now, options)); | 939 valid_cookies.push_back(CanonicalCookie::Create(url2, "A=B", now, options)); |
| 940 | 940 |
| 941 std::vector<scoped_ptr<CanonicalCookie>> invalid_cookies; | 941 std::vector<std::unique_ptr<CanonicalCookie>> invalid_cookies; |
| 942 // We don't match domain cookies. | 942 // We don't match domain cookies. |
| 943 invalid_cookies.push_back( | 943 invalid_cookies.push_back( |
| 944 CanonicalCookie::Create(url2, "A=B;domain=.example.com", now, options)); | 944 CanonicalCookie::Create(url2, "A=B;domain=.example.com", now, options)); |
| 945 invalid_cookies.push_back(CanonicalCookie::Create(url3, "A=B", now, options)); | 945 invalid_cookies.push_back(CanonicalCookie::Create(url3, "A=B", now, options)); |
| 946 | 946 |
| 947 for (const auto& cookie : valid_cookies) | 947 for (const auto& cookie : valid_cookies) |
| 948 EXPECT_TRUE(predicate.Run(*cookie)) << cookie->DebugString(); | 948 EXPECT_TRUE(predicate.Run(*cookie)) << cookie->DebugString(); |
| 949 for (const auto& cookie : invalid_cookies) | 949 for (const auto& cookie : invalid_cookies) |
| 950 EXPECT_FALSE(predicate.Run(*cookie)) << cookie->DebugString(); | 950 EXPECT_FALSE(predicate.Run(*cookie)) << cookie->DebugString(); |
| 951 } | 951 } |
| 952 | 952 |
| 953 } // namespace content | 953 } // namespace content |
| OLD | NEW |