Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/browser/extensions/settings/settings_quota_unittest.cc

Issue 8539037: Extension Settings API: make it so that when changes received from Sync fail to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments, sync Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/extensions/settings/settings_backend.h" 11 #include "chrome/browser/extensions/settings/settings_backend.h"
12 #include "chrome/browser/extensions/settings/settings_storage_cache.h" 12 #include "chrome/browser/extensions/settings/settings_storage_cache.h"
13 #include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h" 13 #include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h"
14 #include "chrome/browser/extensions/settings/in_memory_settings_storage.h" 14 #include "chrome/browser/extensions/settings/testing_settings_storage.h"
15 15
16 namespace extensions { 16 namespace extensions {
17 17
18 class ExtensionSettingsQuotaTest : public testing::Test { 18 class ExtensionSettingsQuotaTest : public testing::Test {
19 public: 19 public:
20 ExtensionSettingsQuotaTest() 20 ExtensionSettingsQuotaTest()
21 : byte_value_1_(Value::CreateIntegerValue(1)), 21 : byte_value_1_(Value::CreateIntegerValue(1)),
22 byte_value_16_(Value::CreateStringValue("sixteen bytes.")), 22 byte_value_16_(Value::CreateStringValue("sixteen bytes.")),
23 byte_value_256_(new ListValue()), 23 byte_value_256_(new ListValue()),
24 delegate_( 24 delegate_(new SettingsStorageCache(new TestingSettingsStorage())) {
25 new SettingsStorageCache(
26 new InMemorySettingsStorage())) {
27 for (int i = 1; i < 89; ++i) { 25 for (int i = 1; i < 89; ++i) {
28 byte_value_256_->Append(Value::CreateIntegerValue(i)); 26 byte_value_256_->Append(Value::CreateIntegerValue(i));
29 } 27 }
30 ValidateByteValues(); 28 ValidateByteValues();
31 } 29 }
32 30
33 void ValidateByteValues() { 31 void ValidateByteValues() {
34 std::string validate_sizes; 32 std::string validate_sizes;
35 base::JSONWriter::Write(byte_value_1_.get(), false, &validate_sizes); 33 base::JSONWriter::Write(byte_value_1_.get(), false, &validate_sizes);
36 ASSERT_EQ(1u, validate_sizes.size()); 34 ASSERT_EQ(1u, validate_sizes.size());
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 514
517 EXPECT_FALSE(storage_->Set("c", *byte_value_1_).HasError()); 515 EXPECT_FALSE(storage_->Set("c", *byte_value_1_).HasError());
518 EXPECT_FALSE(storage_->Set("c", *byte_value_16_).HasError()); 516 EXPECT_FALSE(storage_->Set("c", *byte_value_16_).HasError());
519 settings.Set("c", byte_value_16_->DeepCopy()); 517 settings.Set("c", byte_value_16_->DeepCopy());
520 EXPECT_TRUE(storage_->Set("c", *byte_value_256_).HasError()); 518 EXPECT_TRUE(storage_->Set("c", *byte_value_256_).HasError());
521 519
522 EXPECT_TRUE(SettingsEqual(settings)); 520 EXPECT_TRUE(SettingsEqual(settings));
523 } 521 }
524 522
525 } // namespace extensions 523 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698