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/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Adds a persistent cookie to store_. | 93 // Adds a persistent cookie to store_. |
94 void AddCookie(const GURL& url, | 94 void AddCookie(const GURL& url, |
95 const std::string& name, | 95 const std::string& name, |
96 const std::string& value, | 96 const std::string& value, |
97 const std::string& domain, | 97 const std::string& domain, |
98 const std::string& path, | 98 const std::string& path, |
99 const base::Time& creation) { | 99 const base::Time& creation) { |
100 store_->AddCookie(*net::CanonicalCookie::Create( | 100 store_->AddCookie(*net::CanonicalCookie::Create( |
101 url, name, value, domain, path, creation, creation, false, false, | 101 url, name, value, domain, path, creation, creation, false, false, |
102 net::CookieSameSite::DEFAULT_MODE, false, | 102 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT)); |
103 net::COOKIE_PRIORITY_DEFAULT)); | |
104 } | 103 } |
105 | 104 |
106 void DestroyStore() { | 105 void DestroyStore() { |
107 store_ = nullptr; | 106 store_ = nullptr; |
108 // Ensure that |store_|'s destructor has run by shutting down the pool and | 107 // Ensure that |store_|'s destructor has run by shutting down the pool and |
109 // then forcing the pool to be destructed. This will ensure that all the | 108 // then forcing the pool to be destructed. This will ensure that all the |
110 // tasks that block pool shutdown (e.g. |store_|'s cleanup) have run before | 109 // tasks that block pool shutdown (e.g. |store_|'s cleanup) have run before |
111 // yielding control. | 110 // yielding control. |
112 pool_owner_->pool()->FlushForTesting(); | 111 pool_owner_->pool()->FlushForTesting(); |
113 pool_owner_.reset(new base::SequencedWorkerPoolOwner(3, "Background Pool")); | 112 pool_owner_.reset(new base::SequencedWorkerPoolOwner(3, "Background Pool")); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // Reload and test for persistence. | 281 // Reload and test for persistence. |
283 cookies.clear(); | 282 cookies.clear(); |
284 CreateAndLoad(storage_policy.get(), &cookies); | 283 CreateAndLoad(storage_policy.get(), &cookies); |
285 EXPECT_EQ(0U, cookies.size()); | 284 EXPECT_EQ(0U, cookies.size()); |
286 | 285 |
287 cookies.clear(); | 286 cookies.clear(); |
288 } | 287 } |
289 | 288 |
290 } // namespace | 289 } // namespace |
291 } // namespace content | 290 } // namespace content |
OLD | NEW |