| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 scoped_refptr<base::SequencedTaskRunner> client_task_runner() { | 78 scoped_refptr<base::SequencedTaskRunner> client_task_runner() { |
| 79 return pool_owner_->pool()->GetSequencedTaskRunner( | 79 return pool_owner_->pool()->GetSequencedTaskRunner( |
| 80 pool_owner_->pool()->GetNamedSequenceToken("client")); | 80 pool_owner_->pool()->GetNamedSequenceToken("client")); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void CreateAndLoad(storage::SpecialStoragePolicy* storage_policy, | 83 void CreateAndLoad(storage::SpecialStoragePolicy* storage_policy, |
| 84 CanonicalCookieVector* cookies) { | 84 CanonicalCookieVector* cookies) { |
| 85 scoped_refptr<net::SQLitePersistentCookieStore> sqlite_store( | 85 scoped_refptr<net::SQLitePersistentCookieStore> sqlite_store( |
| 86 new net::SQLitePersistentCookieStore( | 86 new net::SQLitePersistentCookieStore( |
| 87 temp_dir_.path().Append(kTestCookiesFilename), | 87 temp_dir_.GetPath().Append(kTestCookiesFilename), |
| 88 client_task_runner(), | 88 client_task_runner(), background_task_runner(), true, nullptr)); |
| 89 background_task_runner(), | |
| 90 true, nullptr)); | |
| 91 store_ = new QuotaPolicyCookieStore(sqlite_store.get(), storage_policy); | 89 store_ = new QuotaPolicyCookieStore(sqlite_store.get(), storage_policy); |
| 92 Load(cookies); | 90 Load(cookies); |
| 93 } | 91 } |
| 94 | 92 |
| 95 // Adds a persistent cookie to store_. | 93 // Adds a persistent cookie to store_. |
| 96 void AddCookie(const GURL& url, | 94 void AddCookie(const GURL& url, |
| 97 const std::string& name, | 95 const std::string& name, |
| 98 const std::string& value, | 96 const std::string& value, |
| 99 const std::string& domain, | 97 const std::string& domain, |
| 100 const std::string& path, | 98 const std::string& path, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // Reload and test for persistence. | 282 // Reload and test for persistence. |
| 285 base::STLDeleteElements(&cookies); | 283 base::STLDeleteElements(&cookies); |
| 286 CreateAndLoad(storage_policy.get(), &cookies); | 284 CreateAndLoad(storage_policy.get(), &cookies); |
| 287 EXPECT_EQ(0U, cookies.size()); | 285 EXPECT_EQ(0U, cookies.size()); |
| 288 | 286 |
| 289 base::STLDeleteElements(&cookies); | 287 base::STLDeleteElements(&cookies); |
| 290 } | 288 } |
| 291 | 289 |
| 292 } // namespace | 290 } // namespace |
| 293 } // namespace content | 291 } // namespace content |
| OLD | NEW |