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

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

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 months 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) 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 "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"
(...skipping 16 matching lines...) Expand all
27 byte_value_256_(new ListValue()), 27 byte_value_256_(new ListValue()),
28 delegate_(new TestingSettingsStorage()) { 28 delegate_(new TestingSettingsStorage()) {
29 for (int i = 1; i < 89; ++i) { 29 for (int i = 1; i < 89; ++i) {
30 byte_value_256_->Append(Value::CreateIntegerValue(i)); 30 byte_value_256_->Append(Value::CreateIntegerValue(i));
31 } 31 }
32 ValidateByteValues(); 32 ValidateByteValues();
33 } 33 }
34 34
35 void ValidateByteValues() { 35 void ValidateByteValues() {
36 std::string validate_sizes; 36 std::string validate_sizes;
37 base::JSONWriter::Write(byte_value_1_.get(), false, &validate_sizes); 37 base::JSONWriter::Write(byte_value_1_.get(), &validate_sizes);
38 ASSERT_EQ(1u, validate_sizes.size()); 38 ASSERT_EQ(1u, validate_sizes.size());
39 base::JSONWriter::Write(byte_value_16_.get(), false, &validate_sizes); 39 base::JSONWriter::Write(byte_value_16_.get(), &validate_sizes);
40 ASSERT_EQ(16u, validate_sizes.size()); 40 ASSERT_EQ(16u, validate_sizes.size());
41 base::JSONWriter::Write(byte_value_256_.get(), false, &validate_sizes); 41 base::JSONWriter::Write(byte_value_256_.get(), &validate_sizes);
42 ASSERT_EQ(256u, validate_sizes.size()); 42 ASSERT_EQ(256u, validate_sizes.size());
43 } 43 }
44 44
45 virtual void TearDown() OVERRIDE { 45 virtual void TearDown() OVERRIDE {
46 ASSERT_TRUE(storage_.get() != NULL); 46 ASSERT_TRUE(storage_.get() != NULL);
47 } 47 }
48 48
49 protected: 49 protected:
50 // Creates |storage_|. Must only be called once. 50 // Creates |storage_|. Must only be called once.
51 void CreateStorage( 51 void CreateStorage(
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 586
587 storage_->Set(DEFAULTS, "c", *byte_value_1_); 587 storage_->Set(DEFAULTS, "c", *byte_value_1_);
588 588
589 EXPECT_EQ(6u, storage_->GetBytesInUse()); 589 EXPECT_EQ(6u, storage_->GetBytesInUse());
590 EXPECT_EQ(2u, storage_->GetBytesInUse("a")); 590 EXPECT_EQ(2u, storage_->GetBytesInUse("a"));
591 EXPECT_EQ(2u, storage_->GetBytesInUse("b")); 591 EXPECT_EQ(2u, storage_->GetBytesInUse("b"));
592 EXPECT_EQ(4u, storage_->GetBytesInUse(ab)); 592 EXPECT_EQ(4u, storage_->GetBytesInUse(ab));
593 } 593 }
594 594
595 } // namespace extensions 595 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698