| 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/files/scoped_temp_dir.h" |
| 7 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 8 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 9 #include "base/scoped_temp_dir.h" | |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "webkit/dom_storage/dom_storage_area.h" | 14 #include "webkit/dom_storage/dom_storage_area.h" |
| 15 #include "webkit/dom_storage/dom_storage_context.h" | 15 #include "webkit/dom_storage/dom_storage_context.h" |
| 16 #include "webkit/dom_storage/dom_storage_namespace.h" | 16 #include "webkit/dom_storage/dom_storage_namespace.h" |
| 17 #include "webkit/dom_storage/dom_storage_task_runner.h" | 17 #include "webkit/dom_storage/dom_storage_task_runner.h" |
| 18 #include "webkit/dom_storage/dom_storage_types.h" | 18 #include "webkit/dom_storage/dom_storage_types.h" |
| 19 #include "webkit/quota/mock_special_storage_policy.h" | 19 #include "webkit/quota/mock_special_storage_policy.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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<LocalStorageUsageInfo> infos; | 58 std::vector<LocalStorageUsageInfo> infos; |
| 59 context->GetLocalStorageUsage(&infos, kDontIncludeFileInfo); | 59 context->GetLocalStorageUsage(&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 MessageLoop message_loop_; |
| 66 ScopedTempDir temp_dir_; | 66 base::ScopedTempDir temp_dir_; |
| 67 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy_; | 67 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy_; |
| 68 scoped_refptr<MockDomStorageTaskRunner> task_runner_; | 68 scoped_refptr<MockDomStorageTaskRunner> task_runner_; |
| 69 scoped_refptr<DomStorageContext> context_; | 69 scoped_refptr<DomStorageContext> context_; |
| 70 DISALLOW_COPY_AND_ASSIGN(DomStorageContextTest); | 70 DISALLOW_COPY_AND_ASSIGN(DomStorageContextTest); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 TEST_F(DomStorageContextTest, Basics) { | 73 TEST_F(DomStorageContextTest, Basics) { |
| 74 // This test doesn't do much, checks that the constructor | 74 // This test doesn't do much, checks that the constructor |
| 75 // initializes members properly and that invoking methods | 75 // initializes members properly and that invoking methods |
| 76 // on a newly created object w/o any data on disk do no harm. | 76 // on a newly created object w/o any data on disk do no harm. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 area = dom_namespace->OpenStorageArea(kOrigin); | 253 area = dom_namespace->OpenStorageArea(kOrigin); |
| 254 read_value = area->GetItem(kKey); | 254 read_value = area->GetItem(kKey); |
| 255 EXPECT_TRUE(read_value.is_null()); | 255 EXPECT_TRUE(read_value.is_null()); |
| 256 dom_namespace->CloseStorageArea(area); | 256 dom_namespace->CloseStorageArea(area); |
| 257 context_->Shutdown(); | 257 context_->Shutdown(); |
| 258 context_ = NULL; | 258 context_ = NULL; |
| 259 MessageLoop::current()->RunAllPending(); | 259 MessageLoop::current()->RunAllPending(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace dom_storage | 262 } // namespace dom_storage |
| OLD | NEW |