OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 // Returns whether the settings in |storage_| and |delegate_| are the same as | 63 // Returns whether the settings in |storage_| and |delegate_| are the same as |
64 // |settings|. | 64 // |settings|. |
65 bool SettingsEqual(const base::DictionaryValue& settings) { | 65 bool SettingsEqual(const base::DictionaryValue& settings) { |
66 return settings.Equals(&storage_->Get()->settings()) && | 66 return settings.Equals(&storage_->Get()->settings()) && |
67 settings.Equals(&delegate_->Get()->settings()); | 67 settings.Equals(&delegate_->Get()->settings()); |
68 } | 68 } |
69 | 69 |
70 // Values with different serialized sizes. | 70 // Values with different serialized sizes. |
71 base::FundamentalValue byte_value_1_; | 71 base::Value byte_value_1_; |
72 base::StringValue byte_value_16_; | 72 base::StringValue byte_value_16_; |
73 base::ListValue byte_value_256_; | 73 base::ListValue byte_value_256_; |
74 | 74 |
75 // Quota enforcing storage area being tested. | 75 // Quota enforcing storage area being tested. |
76 std::unique_ptr<SettingsStorageQuotaEnforcer> storage_; | 76 std::unique_ptr<SettingsStorageQuotaEnforcer> storage_; |
77 | 77 |
78 // In-memory storage area being delegated to. Always owned by |storage_|. | 78 // In-memory storage area being delegated to. Always owned by |storage_|. |
79 TestingValueStore* delegate_; | 79 TestingValueStore* delegate_; |
80 }; | 80 }; |
81 | 81 |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 | 590 |
591 storage_->Set(DEFAULTS, "c", byte_value_1_); | 591 storage_->Set(DEFAULTS, "c", byte_value_1_); |
592 | 592 |
593 EXPECT_EQ(6u, storage_->GetBytesInUse()); | 593 EXPECT_EQ(6u, storage_->GetBytesInUse()); |
594 EXPECT_EQ(2u, storage_->GetBytesInUse("a")); | 594 EXPECT_EQ(2u, storage_->GetBytesInUse("a")); |
595 EXPECT_EQ(2u, storage_->GetBytesInUse("b")); | 595 EXPECT_EQ(2u, storage_->GetBytesInUse("b")); |
596 EXPECT_EQ(4u, storage_->GetBytesInUse(ab)); | 596 EXPECT_EQ(4u, storage_->GetBytesInUse(ab)); |
597 } | 597 } |
598 | 598 |
599 } // namespace extensions | 599 } // namespace extensions |
OLD | NEW |