| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Use a new instance to examine the contexts of temp_dir_. | 55 // Use a new instance to examine the contexts of temp_dir_. |
| 56 scoped_refptr<DomStorageContext> context = | 56 scoped_refptr<DomStorageContext> context = |
| 57 new DomStorageContext(temp_dir_.path(), FilePath(), NULL, NULL); | 57 new DomStorageContext(temp_dir_.path(), FilePath(), NULL, NULL); |
| 58 std::vector<DomStorageContext::UsageInfo> infos; | 58 std::vector<DomStorageContext::UsageInfo> infos; |
| 59 context->GetUsageInfo(&infos, kDontIncludeFileInfo); | 59 context->GetUsageInfo(&infos, kDontIncludeFileInfo); |
| 60 ASSERT_EQ(1u, infos.size()); | 60 ASSERT_EQ(1u, infos.size()); |
| 61 EXPECT_EQ(origin, infos[0].origin); | 61 EXPECT_EQ(origin, infos[0].origin); |
| 62 } | 62 } |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 MessageLoop message_loop_; |
| 65 ScopedTempDir temp_dir_; | 66 ScopedTempDir temp_dir_; |
| 66 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy_; | 67 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy_; |
| 67 scoped_refptr<MockDomStorageTaskRunner> task_runner_; | 68 scoped_refptr<MockDomStorageTaskRunner> task_runner_; |
| 68 scoped_refptr<DomStorageContext> context_; | 69 scoped_refptr<DomStorageContext> context_; |
| 69 DISALLOW_COPY_AND_ASSIGN(DomStorageContextTest); | 70 DISALLOW_COPY_AND_ASSIGN(DomStorageContextTest); |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 TEST_F(DomStorageContextTest, Basics) { | 73 TEST_F(DomStorageContextTest, Basics) { |
| 73 // This test doesn't do much, checks that the constructor | 74 // This test doesn't do much, checks that the constructor |
| 74 // initializes members properly and that invoking methods | 75 // initializes members properly and that invoking methods |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 OpenStorageArea(kSessionOnlyOrigin)->SetItem(kKey, kValue, &old_value)); | 153 OpenStorageArea(kSessionOnlyOrigin)->SetItem(kKey, kValue, &old_value)); |
| 153 context_->SetForceKeepSessionState(); // Should override clear behavior. | 154 context_->SetForceKeepSessionState(); // Should override clear behavior. |
| 154 context_->Shutdown(); | 155 context_->Shutdown(); |
| 155 context_ = NULL; | 156 context_ = NULL; |
| 156 MessageLoop::current()->RunAllPending(); | 157 MessageLoop::current()->RunAllPending(); |
| 157 | 158 |
| 158 VerifySingleOriginRemains(kSessionOnlyOrigin); | 159 VerifySingleOriginRemains(kSessionOnlyOrigin); |
| 159 } | 160 } |
| 160 | 161 |
| 161 } // namespace dom_storage | 162 } // namespace dom_storage |
| OLD | NEW |