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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 false, false, false, net::COOKIE_PRIORITY_DEFAULT)); | 102 false, false, false, net::COOKIE_PRIORITY_DEFAULT)); |
103 } | 103 } |
104 | 104 |
105 void DestroyStore() { | 105 void DestroyStore() { |
106 store_ = nullptr; | 106 store_ = nullptr; |
107 // 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 |
108 // 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 |
109 // 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 |
110 // yielding control. | 110 // yielding control. |
111 pool_owner_->pool()->FlushForTesting(); | 111 pool_owner_->pool()->FlushForTesting(); |
| 112 pool_owner_->pool()->Shutdown(); |
112 pool_owner_.reset(new base::SequencedWorkerPoolOwner(3, "Background Pool")); | 113 pool_owner_.reset(new base::SequencedWorkerPoolOwner(3, "Background Pool")); |
113 } | 114 } |
114 | 115 |
115 void SetUp() override { | 116 void SetUp() override { |
116 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 117 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
117 } | 118 } |
118 | 119 |
119 void TearDown() override { | 120 void TearDown() override { |
120 DestroyStore(); | 121 DestroyStore(); |
| 122 pool_owner_->pool()->Shutdown(); |
121 } | 123 } |
122 | 124 |
123 TestBrowserThreadBundle bundle_; | 125 TestBrowserThreadBundle bundle_; |
124 scoped_ptr<base::SequencedWorkerPoolOwner> pool_owner_; | 126 scoped_ptr<base::SequencedWorkerPoolOwner> pool_owner_; |
125 base::WaitableEvent loaded_event_; | 127 base::WaitableEvent loaded_event_; |
126 base::WaitableEvent destroy_event_; | 128 base::WaitableEvent destroy_event_; |
127 base::ScopedTempDir temp_dir_; | 129 base::ScopedTempDir temp_dir_; |
128 scoped_refptr<QuotaPolicyCookieStore> store_; | 130 scoped_refptr<QuotaPolicyCookieStore> store_; |
129 CanonicalCookieVector cookies_; | 131 CanonicalCookieVector cookies_; |
130 }; | 132 }; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // Reload and test for persistence. | 282 // Reload and test for persistence. |
281 STLDeleteElements(&cookies); | 283 STLDeleteElements(&cookies); |
282 CreateAndLoad(storage_policy.get(), &cookies); | 284 CreateAndLoad(storage_policy.get(), &cookies); |
283 EXPECT_EQ(0U, cookies.size()); | 285 EXPECT_EQ(0U, cookies.size()); |
284 | 286 |
285 STLDeleteElements(&cookies); | 287 STLDeleteElements(&cookies); |
286 } | 288 } |
287 | 289 |
288 } // namespace | 290 } // namespace |
289 } // namespace content | 291 } // namespace content |
OLD | NEW |