| 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 <stdint.h> |
| 8 |
| 7 #include <list> | 9 #include <list> |
| 8 | 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 11 #include "content/renderer/dom_storage/dom_storage_proxy.h" | 13 #include "content/renderer/dom_storage/dom_storage_proxy.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 class DOMStorageCachedAreaTest : public testing::Test { | 113 class DOMStorageCachedAreaTest : public testing::Test { |
| 112 public: | 114 public: |
| 113 DOMStorageCachedAreaTest() | 115 DOMStorageCachedAreaTest() |
| 114 : kNamespaceId(10), | 116 : kNamespaceId(10), |
| 115 kOrigin("http://dom_storage/"), | 117 kOrigin("http://dom_storage/"), |
| 116 kKey(base::ASCIIToUTF16("key")), | 118 kKey(base::ASCIIToUTF16("key")), |
| 117 kValue(base::ASCIIToUTF16("value")), | 119 kValue(base::ASCIIToUTF16("value")), |
| 118 kPageUrl("http://dom_storage/page") { | 120 kPageUrl("http://dom_storage/page") { |
| 119 } | 121 } |
| 120 | 122 |
| 121 const int64 kNamespaceId; | 123 const int64_t kNamespaceId; |
| 122 const GURL kOrigin; | 124 const GURL kOrigin; |
| 123 const base::string16 kKey; | 125 const base::string16 kKey; |
| 124 const base::string16 kValue; | 126 const base::string16 kValue; |
| 125 const GURL kPageUrl; | 127 const GURL kPageUrl; |
| 126 | 128 |
| 127 void SetUp() override { mock_proxy_ = new MockProxy(); } | 129 void SetUp() override { mock_proxy_ = new MockProxy(); } |
| 128 | 130 |
| 129 bool IsPrimed(DOMStorageCachedArea* cached_area) { | 131 bool IsPrimed(DOMStorageCachedArea* cached_area) { |
| 130 return cached_area->map_.get(); | 132 return cached_area->map_.get(); |
| 131 } | 133 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 EXPECT_FALSE(IsIgnoringKeyMutations(cached_area.get(), kKey)); | 347 EXPECT_FALSE(IsIgnoringKeyMutations(cached_area.get(), kKey)); |
| 346 | 348 |
| 347 // A failed set item operation should Reset the cache. | 349 // A failed set item operation should Reset the cache. |
| 348 EXPECT_TRUE(cached_area->SetItem(kConnectionId, kKey, kValue, kPageUrl)); | 350 EXPECT_TRUE(cached_area->SetItem(kConnectionId, kKey, kValue, kPageUrl)); |
| 349 EXPECT_TRUE(IsIgnoringKeyMutations(cached_area.get(), kKey)); | 351 EXPECT_TRUE(IsIgnoringKeyMutations(cached_area.get(), kKey)); |
| 350 mock_proxy_->CompleteOnePendingCallback(false); | 352 mock_proxy_->CompleteOnePendingCallback(false); |
| 351 EXPECT_FALSE(IsPrimed(cached_area.get())); | 353 EXPECT_FALSE(IsPrimed(cached_area.get())); |
| 352 } | 354 } |
| 353 | 355 |
| 354 } // namespace content | 356 } // namespace content |
| OLD | NEW |