| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 typedef std::vector<net::CanonicalCookie*> CanonicalCookieVector; | 33 typedef std::vector<net::CanonicalCookie*> CanonicalCookieVector; |
| 34 | 34 |
| 35 class QuotaPolicyCookieStoreTest : public testing::Test { | 35 class QuotaPolicyCookieStoreTest : public testing::Test { |
| 36 public: | 36 public: |
| 37 QuotaPolicyCookieStoreTest() | 37 QuotaPolicyCookieStoreTest() |
| 38 : pool_owner_(new base::SequencedWorkerPoolOwner(3, "Background Pool")), | 38 : pool_owner_(new base::SequencedWorkerPoolOwner(3, "Background Pool")), |
| 39 loaded_event_(false, false), | 39 loaded_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 40 destroy_event_(false, false) { | 40 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 41 } | 41 destroy_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 42 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 42 | 43 |
| 43 void OnLoaded(const CanonicalCookieVector& cookies) { | 44 void OnLoaded(const CanonicalCookieVector& cookies) { |
| 44 cookies_ = cookies; | 45 cookies_ = cookies; |
| 45 loaded_event_.Signal(); | 46 loaded_event_.Signal(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 void Load(CanonicalCookieVector* cookies) { | 49 void Load(CanonicalCookieVector* cookies) { |
| 49 EXPECT_FALSE(loaded_event_.IsSignaled()); | 50 EXPECT_FALSE(loaded_event_.IsSignaled()); |
| 50 store_->Load(base::Bind(&QuotaPolicyCookieStoreTest::OnLoaded, | 51 store_->Load(base::Bind(&QuotaPolicyCookieStoreTest::OnLoaded, |
| 51 base::Unretained(this))); | 52 base::Unretained(this))); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 // Reload and test for persistence. | 281 // Reload and test for persistence. |
| 281 STLDeleteElements(&cookies); | 282 STLDeleteElements(&cookies); |
| 282 CreateAndLoad(storage_policy.get(), &cookies); | 283 CreateAndLoad(storage_policy.get(), &cookies); |
| 283 EXPECT_EQ(0U, cookies.size()); | 284 EXPECT_EQ(0U, cookies.size()); |
| 284 | 285 |
| 285 STLDeleteElements(&cookies); | 286 STLDeleteElements(&cookies); |
| 286 } | 287 } |
| 287 | 288 |
| 288 } // namespace | 289 } // namespace |
| 289 } // namespace content | 290 } // namespace content |
| OLD | NEW |