| 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 "content/browser/net/quota_policy_cookie_store.h" | 5 #include "content/browser/net/quota_policy_cookie_store.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 void Load(CanonicalCookieVector* cookies) { | 50 void Load(CanonicalCookieVector* cookies) { |
| 51 EXPECT_FALSE(loaded_event_.IsSignaled()); | 51 EXPECT_FALSE(loaded_event_.IsSignaled()); |
| 52 store_->Load(base::Bind(&QuotaPolicyCookieStoreTest::OnLoaded, | 52 store_->Load(base::Bind(&QuotaPolicyCookieStoreTest::OnLoaded, |
| 53 base::Unretained(this))); | 53 base::Unretained(this))); |
| 54 loaded_event_.Wait(); | 54 loaded_event_.Wait(); |
| 55 cookies->swap(cookies_); | 55 cookies->swap(cookies_); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ReleaseStore() { | 58 void ReleaseStore() { |
| 59 EXPECT_TRUE(background_task_runner()->RunsTasksOnCurrentThread()); | 59 EXPECT_TRUE(background_task_runner()->RunsTasksInCurrentSequence()); |
| 60 store_ = nullptr; | 60 store_ = nullptr; |
| 61 destroy_event_.Signal(); | 61 destroy_event_.Signal(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void DestroyStoreOnBackgroundThread() { | 64 void DestroyStoreOnBackgroundThread() { |
| 65 background_task_runner()->PostTask( | 65 background_task_runner()->PostTask( |
| 66 FROM_HERE, base::Bind(&QuotaPolicyCookieStoreTest::ReleaseStore, | 66 FROM_HERE, base::Bind(&QuotaPolicyCookieStoreTest::ReleaseStore, |
| 67 base::Unretained(this))); | 67 base::Unretained(this))); |
| 68 destroy_event_.Wait(); | 68 destroy_event_.Wait(); |
| 69 DestroyStore(); | 69 DestroyStore(); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // Reload and test for persistence. | 281 // Reload and test for persistence. |
| 282 cookies.clear(); | 282 cookies.clear(); |
| 283 CreateAndLoad(storage_policy.get(), &cookies); | 283 CreateAndLoad(storage_policy.get(), &cookies); |
| 284 EXPECT_EQ(0U, cookies.size()); | 284 EXPECT_EQ(0U, cookies.size()); |
| 285 | 285 |
| 286 cookies.clear(); | 286 cookies.clear(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace | 289 } // namespace |
| 290 } // namespace content | 290 } // namespace content |
| OLD | NEW |