| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | |
| 10 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "base/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "content/browser/dom_storage/dom_storage_area.h" | 13 #include "content/browser/dom_storage/dom_storage_area.h" |
| 14 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 14 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 15 #include "content/browser/dom_storage/dom_storage_namespace.h" | 15 #include "content/browser/dom_storage/dom_storage_namespace.h" |
| 16 #include "content/browser/dom_storage/dom_storage_task_runner.h" | 16 #include "content/browser/dom_storage/dom_storage_task_runner.h" |
| 17 #include "content/public/browser/local_storage_usage_info.h" | 17 #include "content/public/browser/local_storage_usage_info.h" |
| 18 #include "content/public/browser/session_storage_usage_info.h" | 18 #include "content/public/browser/session_storage_usage_info.h" |
| 19 #include "content/public/test/mock_special_storage_policy.h" | 19 #include "content/public/test/mock_special_storage_policy.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 const GURL kOrigin; | 36 const GURL kOrigin; |
| 37 const base::string16 kKey; | 37 const base::string16 kKey; |
| 38 const base::string16 kValue; | 38 const base::string16 kValue; |
| 39 const bool kDontIncludeFileInfo; | 39 const bool kDontIncludeFileInfo; |
| 40 const bool kDoIncludeFileInfo; | 40 const bool kDoIncludeFileInfo; |
| 41 | 41 |
| 42 void SetUp() override { | 42 void SetUp() override { |
| 43 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 43 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 44 storage_policy_ = new MockSpecialStoragePolicy; | 44 storage_policy_ = new MockSpecialStoragePolicy; |
| 45 task_runner_ = | 45 task_runner_ = |
| 46 new MockDOMStorageTaskRunner(base::MessageLoopProxy::current().get()); | 46 new MockDOMStorageTaskRunner(base::ThreadTaskRunnerHandle::Get().get()); |
| 47 context_ = new DOMStorageContextImpl(temp_dir_.path(), | 47 context_ = new DOMStorageContextImpl(temp_dir_.path(), |
| 48 base::FilePath(), | 48 base::FilePath(), |
| 49 storage_policy_.get(), | 49 storage_policy_.get(), |
| 50 task_runner_.get()); | 50 task_runner_.get()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void TearDown() override { base::MessageLoop::current()->RunUntilIdle(); } | 53 void TearDown() override { base::MessageLoop::current()->RunUntilIdle(); } |
| 54 | 54 |
| 55 void VerifySingleOriginRemains(const GURL& origin) { | 55 void VerifySingleOriginRemains(const GURL& origin) { |
| 56 // Use a new instance to examine the contexts of temp_dir_. | 56 // Use a new instance to examine the contexts of temp_dir_. |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 area = dom_namespace->OpenStorageArea(kOrigin); | 255 area = dom_namespace->OpenStorageArea(kOrigin); |
| 256 read_value = area->GetItem(kKey); | 256 read_value = area->GetItem(kKey); |
| 257 EXPECT_TRUE(read_value.is_null()); | 257 EXPECT_TRUE(read_value.is_null()); |
| 258 dom_namespace->CloseStorageArea(area); | 258 dom_namespace->CloseStorageArea(area); |
| 259 context_->Shutdown(); | 259 context_->Shutdown(); |
| 260 context_ = NULL; | 260 context_ = NULL; |
| 261 base::MessageLoop::current()->RunUntilIdle(); | 261 base::MessageLoop::current()->RunUntilIdle(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace content | 264 } // namespace content |
| OLD | NEW |