| 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" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 kDontIncludeFileInfo(false), | 33 kDontIncludeFileInfo(false), |
| 34 kDoIncludeFileInfo(true) { | 34 kDoIncludeFileInfo(true) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 const GURL kOrigin; | 37 const GURL kOrigin; |
| 38 const base::string16 kKey; | 38 const base::string16 kKey; |
| 39 const base::string16 kValue; | 39 const base::string16 kValue; |
| 40 const bool kDontIncludeFileInfo; | 40 const bool kDontIncludeFileInfo; |
| 41 const bool kDoIncludeFileInfo; | 41 const bool kDoIncludeFileInfo; |
| 42 | 42 |
| 43 virtual void SetUp() { | 43 void SetUp() override { |
| 44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 45 storage_policy_ = new MockSpecialStoragePolicy; | 45 storage_policy_ = new MockSpecialStoragePolicy; |
| 46 task_runner_ = | 46 task_runner_ = |
| 47 new MockDOMStorageTaskRunner(base::MessageLoopProxy::current().get()); | 47 new MockDOMStorageTaskRunner(base::MessageLoopProxy::current().get()); |
| 48 context_ = new DOMStorageContextImpl(temp_dir_.path(), | 48 context_ = new DOMStorageContextImpl(temp_dir_.path(), |
| 49 base::FilePath(), | 49 base::FilePath(), |
| 50 storage_policy_.get(), | 50 storage_policy_.get(), |
| 51 task_runner_.get()); | 51 task_runner_.get()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual void TearDown() { | 54 void TearDown() override { base::MessageLoop::current()->RunUntilIdle(); } |
| 55 base::MessageLoop::current()->RunUntilIdle(); | |
| 56 } | |
| 57 | 55 |
| 58 void VerifySingleOriginRemains(const GURL& origin) { | 56 void VerifySingleOriginRemains(const GURL& origin) { |
| 59 // Use a new instance to examine the contexts of temp_dir_. | 57 // Use a new instance to examine the contexts of temp_dir_. |
| 60 scoped_refptr<DOMStorageContextImpl> context = | 58 scoped_refptr<DOMStorageContextImpl> context = |
| 61 new DOMStorageContextImpl(temp_dir_.path(), base::FilePath(), | 59 new DOMStorageContextImpl(temp_dir_.path(), base::FilePath(), |
| 62 NULL, NULL); | 60 NULL, NULL); |
| 63 std::vector<LocalStorageUsageInfo> infos; | 61 std::vector<LocalStorageUsageInfo> infos; |
| 64 context->GetLocalStorageUsage(&infos, kDontIncludeFileInfo); | 62 context->GetLocalStorageUsage(&infos, kDontIncludeFileInfo); |
| 65 ASSERT_EQ(1u, infos.size()); | 63 ASSERT_EQ(1u, infos.size()); |
| 66 EXPECT_EQ(origin, infos[0].origin); | 64 EXPECT_EQ(origin, infos[0].origin); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 // Verify that the merge was successful. | 365 // Verify that the merge was successful. |
| 368 ASSERT_TRUE(alias_ns->alias_master_namespace() == target_ns); | 366 ASSERT_TRUE(alias_ns->alias_master_namespace() == target_ns); |
| 369 base::NullableString16 read_value = target_ns_area->GetItem(kKey); | 367 base::NullableString16 read_value = target_ns_area->GetItem(kKey); |
| 370 EXPECT_TRUE(!read_value.is_null() && read_value.string() == kValue2); | 368 EXPECT_TRUE(!read_value.is_null() && read_value.string() == kValue2); |
| 371 DOMStorageArea* alias_ns_area = alias_ns->OpenStorageArea(kOrigin); | 369 DOMStorageArea* alias_ns_area = alias_ns->OpenStorageArea(kOrigin); |
| 372 read_value = alias_ns_area->GetItem(kKey2); | 370 read_value = alias_ns_area->GetItem(kKey2); |
| 373 EXPECT_TRUE(!read_value.is_null() && read_value.string() == kKey2Value); | 371 EXPECT_TRUE(!read_value.is_null() && read_value.string() == kKey2Value); |
| 374 } | 372 } |
| 375 | 373 |
| 376 } // namespace content | 374 } // namespace content |
| OLD | NEW |