| 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 "content/renderer/dom_storage/dom_storage_cached_area.h" | 5 #include "content/renderer/dom_storage/dom_storage_cached_area.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 kValue(base::ASCIIToUTF16("value")), | 123 kValue(base::ASCIIToUTF16("value")), |
| 124 kPageUrl("http://dom_storage/page") { | 124 kPageUrl("http://dom_storage/page") { |
| 125 } | 125 } |
| 126 | 126 |
| 127 const int64 kNamespaceId; | 127 const int64 kNamespaceId; |
| 128 const GURL kOrigin; | 128 const GURL kOrigin; |
| 129 const base::string16 kKey; | 129 const base::string16 kKey; |
| 130 const base::string16 kValue; | 130 const base::string16 kValue; |
| 131 const GURL kPageUrl; | 131 const GURL kPageUrl; |
| 132 | 132 |
| 133 virtual void SetUp() { | 133 void SetUp() override { mock_proxy_ = new MockProxy(); } |
| 134 mock_proxy_ = new MockProxy(); | |
| 135 } | |
| 136 | 134 |
| 137 bool IsPrimed(DOMStorageCachedArea* cached_area) { | 135 bool IsPrimed(DOMStorageCachedArea* cached_area) { |
| 138 return cached_area->map_.get(); | 136 return cached_area->map_.get(); |
| 139 } | 137 } |
| 140 | 138 |
| 141 bool IsIgnoringAllMutations(DOMStorageCachedArea* cached_area) { | 139 bool IsIgnoringAllMutations(DOMStorageCachedArea* cached_area) { |
| 142 return cached_area->ignore_all_mutations_; | 140 return cached_area->ignore_all_mutations_; |
| 143 } | 141 } |
| 144 | 142 |
| 145 bool IsIgnoringKeyMutations(DOMStorageCachedArea* cached_area, | 143 bool IsIgnoringKeyMutations(DOMStorageCachedArea* cached_area, |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 EXPECT_FALSE(IsIgnoringKeyMutations(cached_area.get(), kKey)); | 351 EXPECT_FALSE(IsIgnoringKeyMutations(cached_area.get(), kKey)); |
| 354 | 352 |
| 355 // A failed set item operation should Reset the cache. | 353 // A failed set item operation should Reset the cache. |
| 356 EXPECT_TRUE(cached_area->SetItem(kConnectionId, kKey, kValue, kPageUrl)); | 354 EXPECT_TRUE(cached_area->SetItem(kConnectionId, kKey, kValue, kPageUrl)); |
| 357 EXPECT_TRUE(IsIgnoringKeyMutations(cached_area.get(), kKey)); | 355 EXPECT_TRUE(IsIgnoringKeyMutations(cached_area.get(), kKey)); |
| 358 mock_proxy_->CompleteOnePendingCallback(false); | 356 mock_proxy_->CompleteOnePendingCallback(false); |
| 359 EXPECT_FALSE(IsPrimed(cached_area.get())); | 357 EXPECT_FALSE(IsPrimed(cached_area.get())); |
| 360 } | 358 } |
| 361 | 359 |
| 362 } // namespace content | 360 } // namespace content |
| OLD | NEW |